Skip to content

Instantly share code, notes, and snippets.

@pjb3
Created September 4, 2008 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjb3/8703 to your computer and use it in GitHub Desktop.
Save pjb3/8703 to your computer and use it in GitHub Desktop.
def do_something(callbacks={})
callbacks[:before].call if callbacks[:before]
yield
callbacks[:after].call if callbacks[:after]
end
do_something({
:before => lambda {
puts "Will this work?"
},
:after => lambda {
puts "Oh My!"
}
}) { puts "This is crazy" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment