Skip to content

Instantly share code, notes, and snippets.

@pschyska
Created December 3, 2010 11:53
Show Gist options
  • Save pschyska/726874 to your computer and use it in GitHub Desktop.
Save pschyska/726874 to your computer and use it in GitHub Desktop.
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