August 2010
2 posts
Ruby lambda in a different scope
When you create a ruby lambda it is bound the the scope it was defined in. Therefore, if you create it in the class scope, you cannot access instance variables or protected instance methods.
To execute the lambda in your instance’s scope, use the instance_eval method:
Git Post Commit Hook to Play "Hallelujah" After a...
Inspired by Brandon Keepers, what follows is a self contained script that will play a single Hallelujah after you commit.
To make it work, place it in your repository’s .git/hooks directory as post-commit and chmod it executable.