Created
March 6, 2012 11:26
-
-
Save timruffles/1985780 to your computer and use it in GitHub Desktop.
Config via override
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 Conf | |
| class << self | |
| class << self | |
| def if_undef method, &block | |
| define_method method, &block unless Conf.respond_to? method | |
| end | |
| end | |
| if_undef :foo do | |
| "foo" | |
| end | |
| def bar | |
| "original" | |
| end | |
| if_undef :bar do | |
| "new" | |
| end | |
| end | |
| end | |
| puts Conf.foo | |
| puts Conf.bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment