Created
December 30, 2011 09:55
-
-
Save mxrguspxrt/1539073 to your computer and use it in GitHub Desktop.
replace method object handled like a object
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
# example | |
class A | |
def a | |
puts "a" | |
end | |
def b | |
puts "b" | |
end | |
end | |
c = A.new | |
m1 = c.method(:a) | |
m2 = c.method(:b) | |
# now how can i switch m1 and m2 without using "def ..."? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment