Skip to content

Instantly share code, notes, and snippets.

@abriening
Created March 26, 2013 02:37
Show Gist options
  • Save abriening/5242684 to your computer and use it in GitHub Desktop.
Save abriening/5242684 to your computer and use it in GitHub Desktop.
class Proc
def bind(receiver)
unbound_method = receiver.class.unbound_method self
unbound_method.bind receiver
end
end
class Object
def self.unbound_method(proc)
define_method :__temp_unbound_method__, &proc
x = instance_method(:__temp_unbound_method__)
send :undef_method, :__temp_unbound_method__
x
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment