Module: Packable::Extensions::Proc

Defined in:
lib/packable/extensions/proc.rb

Instance Method Summary collapse

Instance Method Details

#bind(to) ⇒ Object

Shortcut for unbind.bind(to)



11
12
13
# File 'lib/packable/extensions/proc.rb', line 11

def bind(to)
  unbind.bind(to)
end

#unbindObject

A bit of wizardry to return an UnboundMethod which can be bound to any object



5
6
7
8
# File 'lib/packable/extensions/proc.rb', line 5

def unbind
  Object.send(:define_method, :__temp_bound_method, &self)
  Object.instance_method(:__temp_bound_method)
end