class Object

Public Instance Methods

Block2Method(&block) click to toggle source

Converts a block to an unbound method. This is useful for more binding a block to an object, so that it can be executed with a different ‘self`.

method = Block2Method do
  puts self[:hello]
end
method.bind({hello: 'World!'}).call
# File lib/block2method.rb, line 11
def Block2Method(&block)
  Block2Method.convert(&block)
end