Class: Proc

Inherits:
Object show all
Defined in:
lib/Qt/qtruby4.rb

Instance Method Summary collapse

Instance Method Details

#bind(object) ⇒ Object

Part of the Rails Object#instance_exec implementation



3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
# File 'lib/Qt/qtruby4.rb', line 3146

def bind(object)
  block, time = self, Time.now
  (class << object; self end).class_eval do
    method_name = "__bind_#{time.to_i}_#{time.usec}"
    define_method(method_name, &block)
    method = instance_method(method_name)
    remove_method(method_name)
    method
  end.bind(object)
end