Created
February 5, 2016 11:02
-
-
Save gaishimo/f2214a572a2c15debf7f to your computer and use it in GitHub Desktop.
class method hook
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
module Module1 | |
def self.method1 | |
puts "method1 is called." | |
end | |
end | |
class Test | |
def self.method_missing(name, *args) | |
if Module1.method_defined?(name) | |
puts "don't call me!!!!!" | |
return Module1.__send__(name, *args) | |
end | |
end | |
end | |
Test.method1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment