Module: Twigg::Decoratable
- Included in:
- CommitSet
- Defined in:
- lib/twigg/decoratable.rb
Instance Method Summary collapse
Instance Method Details
#decorate ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/twigg/decoratable.rb', line 3 def decorate klass = self.class.instance_variable_get('@decorator_class') if !klass components = (self.class.name + 'Decorator').split('::') klass = components.inject(Object) do |namespace, klass| namespace.const_get(klass) end self.class.instance_variable_set('@decorator_class', klass) end klass.new(self) end |