class ActiveSupport::InheritableOptions
h.boy # => ‘John’
h.girl # => ‘Mary’
h = ActiveSupport::InheritableOptions.new({ girl: ‘Mary’, boy: ‘John’ })
Use this if you already have some hash and you want to create a new one based on it.
hash inherited from another hash.InheritableOptions
provides a constructor to build an OrderedOptions
def inheritable_copy
def inheritable_copy self.class.new(self) end
def initialize(parent = nil)
def initialize(parent = nil) if parent.kind_of?(OrderedOptions) # use the faster _get when dealing with OrderedOptions super() { |h, k| parent._get(k) } elsif parent super() { |h, k| parent[k] } else super() end end