Module: Gemmy::Patches::ProcPatch::InstanceMethods::BindTo

Defined in:
lib/gemmy/patches/proc_patch.rb

Instance Method Summary collapse

Instance Method Details

#bind_to(object) ⇒ Object

facets a = [1,2,3] p1 = Proc.new{ join(‘ ’) } p2 = p1.bind_to(a) p2.call #=> ‘1 2 3’



89
90
91
# File 'lib/gemmy/patches/proc_patch.rb', line 89

def bind_to(object)
  Proc.new{object.instance_eval(&self)}
end