Module: Representable::Inheritable::Hash::InstanceMethods
- Included in:
- Representable::Inheritable::Hash
- Defined in:
- lib/representable/inheritable.rb
Instance Method Summary collapse
- #clone ⇒ Object
-
#inherit!(parent) ⇒ Object
FIXME: this method is currently run exactly once, for representable_attrs.inherit!(parent).
Instance Method Details
#clone ⇒ Object
57 58 59 |
# File 'lib/representable/inheritable.rb', line 57 def clone self.class[ collect { |k,v| [k, clone_value(v)] } ] end |
#inherit!(parent) ⇒ Object
FIXME: this method is currently run exactly once, for representable_attrs.inherit!(parent). it is only used for Config.
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/representable/inheritable.rb', line 43 def inherit!(parent) #merge!(parent.clone) for key in (parent.keys + keys).uniq next unless parent_value = parent[key] self[key].inherit!(parent_value) and next if self[key].is_a?(Inheritable) self[key] = parent_value.clone and next if parent_value.is_a?(Cloneable) self[key] = parent_value # merge! behaviour end self end |