Skip to content

Instantly share code, notes, and snippets.

@nathamanath
Created June 4, 2014 09:58
Show Gist options
  • Save nathamanath/31d706c0b9e891c55e0e to your computer and use it in GitHub Desktop.
Save nathamanath/31d706c0b9e891c55e0e to your computer and use it in GitHub Desktop.
Base class for ruby on rails decorators
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
@nathamanath
Copy link
Author

Decorator base class for ruby

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment