Top Level Namespace

Defined Under Namespace

Modules: Block2Method

Instance Method Summary collapse

Instance Method Details

#Block2Method(&block) ⇒ Object

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


11
12
13
# File 'lib/block2method.rb', line 11

def Block2Method(&block)
  Block2Method.convert(&block)
end