aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/proc.rb
blob: 572fc5f92c4fa5aca6fdf28f393ec32bee72f545 (plain) (tree)
1
2
3
4
5
6
7
8


                                
                        
                                                      


                                                                                                   



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