Created
October 12, 2008 06:47
-
-
Save ELLIOTTCABLE/16371 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Foo | |
| def self.method_added(meth); puts "Foo#method_added: #{meth}"; end | |
| def self.singleton_method_added(meth); puts "Foo#singleton_method_added: #{meth}"; end | |
| # Singleton | |
| class << self | |
| def self.method_added(meth); puts "singleton#method_added: #{meth}"; end | |
| def self.singleton_method_added(meth); puts "singleton#singleton_method_added: #{meth}"; end | |
| # Metasingleton | |
| class << self | |
| def self.method_added(meth); puts "metasingleton#method_added: #{meth}"; end | |
| def self.singleton_method_added(meth); puts "metasingleton#singleton_method_added: #{meth}"; end | |
| # Metametasingleton | |
| class << self | |
| def self.method_added(meth); puts "metametasingleton#method_added: #{meth}"; end | |
| def self.singleton_method_added(meth); puts "metametasingleton#singleton_method_added: #{meth}"; end | |
| end | |
| end | |
| end | |
| end | |
| puts '--- -- --- ! --- -- ---' | |
| class Foo | |
| def instance_method; end | |
| def self.singleton_method; end | |
| class << self | |
| def instance_method_on_singleton; end | |
| def self.singleton_method_on_singleton; end | |
| end | |
| end |
This file contains hidden or 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
| Foo#singleton_method_added: singleton_method_added | |
| singleton#singleton_method_added: singleton_method_added | |
| metasingleton#singleton_method_added: singleton_method_added | |
| metametasingleton#singleton_method_added: singleton_method_added | |
| --- -- --- ! --- -- --- | |
| Foo#method_added: instance_method | |
| Foo#singleton_method_added: singleton_method | |
| Foo#singleton_method_added: instance_method_on_singleton | |
| singleton#singleton_method_added: singleton_method_on_singleton |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment