Skip to content

Instantly share code, notes, and snippets.

@ignacy
Created October 11, 2011 10:52
Show Gist options
  • Save ignacy/8d0050e9f6221f8b874c to your computer and use it in GitHub Desktop.
Save ignacy/8d0050e9f6221f8b874c to your computer and use it in GitHub Desktop.
Methods taking multiple blocks
class Multiple
def multiple(success)
rand(2).odd? ? success.call : yield
end
end
i = Multiple.new
10.times do
i.multiple -> { puts "success" } { puts "fail"}
end
@JEG2
Copy link

JEG2 commented Oct 17, 2011

This is what Ruby offers us for free. The goal was to improve on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment