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



3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
# File 'lib/Qt/qtruby4.rb', line 3170

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