Created
December 20, 2009 17:52
-
-
Save leandro/260574 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
| # basic example on how to create module methods not accessible for classes are including it | |
| module Foo | |
| class << self | |
| def show_me | |
| puts 'Foo' | |
| end | |
| end | |
| end | |
| Foo::show_me # => 'Foo' | |
| class FooBar | |
| include Foo | |
| end | |
| FooBar.new.show_me # will throw NoMethodError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment