Created
June 4, 2014 09:58
-
-
Save nathamanath/31d706c0b9e891c55e0e to your computer and use it in GitHub Desktop.
Base class for ruby on rails decorators
This file contains 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 DecoratorBase | |
def initialize(component, args = {}) | |
@component = component | |
@args = args | |
post_initialize | |
end | |
def post_initialize | |
end | |
def method_missing(meth, *args) | |
if @component.respond_to?(meth) | |
@component.send(meth, *args) | |
else | |
super | |
end | |
end | |
def respond_to?(meth) | |
@component.respond_to? meth | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Decorator base class for ruby