Created
December 3, 2010 11:53
-
-
Save pschyska/726874 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 Base | |
def config | |
@config||=configuration | |
end | |
def configuration | |
# no op | |
end | |
end | |
class SuperComponent < Base # for example GirdPanel | |
def config | |
{:some_setting=>'some value'} | |
end | |
end | |
class ChildComponent < SuperComponent | |
def configuration | |
super.merge({:some_toher_setting=>'some other value}) # <- because SuperComponent#configuration is a no-op (inherited from Base), it won't have :some_setting in it | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment