Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 327 Bytes

blocks-can-take-blocks.md

File metadata and controls

19 lines (12 loc) · 327 Bytes

Blocks can take blocks

var = :var
object = Object.new

object.define_singleton_method(:show_var_and_block) do |&block|
  p [var, block]
end

object.show_var_and_block { :block }

# Result:
# [:var, #<Proc:0x007ffd6c038128@./blocks_can_take_blocks.rb:8>]

View Source