Module: Representable::ClassInclusions

Defined in:
lib/representable.rb

Instance Method Summary collapse

Instance Method Details

#included(base) ⇒ Object



86
87
88
89
# File 'lib/representable.rb', line 86

def included(base)
  super
  base.inherit_module!(self)
end

#inherited(subclass) ⇒ Object

DISCUSS: this could be in Decorator? but then we couldn’t do B < A(include X) for non-decorators, right?



91
92
93
94
95
96
# File 'lib/representable.rb', line 91

def inherited(subclass) # DISCUSS: this could be in Decorator? but then we couldn't do B < A(include X) for non-decorators, right?
  super
  # FIXME: subclass.representable_attrs is ALWAYS empty at this point.
  subclass.representable_attrs.inherit!(representable_attrs) # this should be inherit_class!
  # DISCUSS: this could also just be: subclass.inheritable_attr :representable_attrs --> superclass.representable_attrs.clone
end