Skip to content

Instantly share code, notes, and snippets.

@gaishimo
Created February 5, 2016 11:02
Show Gist options
  • Save gaishimo/f2214a572a2c15debf7f to your computer and use it in GitHub Desktop.
Save gaishimo/f2214a572a2c15debf7f to your computer and use it in GitHub Desktop.
class method hook
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