Skip to content
This repository
tag: v3.2.0.rc1
Fetching contributors…

Cannot retrieve contributors at this time

file 14 lines (13 sloc) 0.372 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14
require "active_support/core_ext/kernel/singleton_class"

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)
      method = instance_method(method_name)
      remove_method(method_name)
      method
    end.bind(object)
  end
end
Something went wrong with that request. Please try again.