module Representable::Inheritable::Hash::InstanceMethods
Public Instance Methods
clone()
click to toggle source
# File lib/representable/inheritable.rb, line 57 def clone self.class[ collect { |k,v| [k, clone_value(v)] } ] end
inherit!(parent)
click to toggle source
FIXME: this method is currently run exactly once, for representable_attrs.inherit!(parent). it is only used for Config.
# 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
Private Instance Methods
clone_value(value)
click to toggle source
# File lib/representable/inheritable.rb, line 62 def clone_value(value) return value.clone if value.is_a?(Cloneable) value end