Created
March 26, 2013 02:37
-
-
Save abriening/5242684 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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