Class: Proc
Instance Method Summary collapse
Instance Method Details
#call_with_binding(bind, *args) ⇒ Object
3 4 5 |
# File 'lib/bindless/proc.rb', line 3 def call_with_binding(bind, *args) Bindless::Model.new([bind]).run_proc(self, *args) end |
#call_with_obj(obj, *args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bindless/proc.rb', line 7 def call_with_obj(obj, *args) m = nil p = self Object.class_eval do define_method :a_temp_method_name, &p m = instance_method :a_temp_method_name remove_method :a_temp_method_name end m.bind(obj).call(*args) end |