Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo
- def double_then_yield(num, &block)
- block.call(num * 2)
- end
- end
- foo = Foo.new
- result = foo.double_then_yield 5 do |num|
- num + 1
- end
- puts "result is #{result}" # result is 11
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement