Callbacks are a great technique for achieving simplicity and flexibility. Simply put, a callback is a block of code passed as an argument to a method. In Ruby, code blocks are everywhere and Ruby makes it trivial to pass a block of code to methods. For example: def foo(bar, &block) callback = block callback.call(bar) end foo(5) {|x| x * x} # => 25 But what do we do when a method needs two blocks o
{{#tags}}- {{label}}
{{/tags}}