Method: ActiveSupport::InheritableOptions#initialize

Defined in:
activesupport/lib/active_support/ordered_options.rb

#initialize(parent = nil) ⇒ InheritableOptions

Returns a new instance of InheritableOptions.



90
91
92
93
94
95
96
97
98
99
100
101
# File 'activesupport/lib/active_support/ordered_options.rb', line 90

def initialize(parent = nil)
  @parent = parent
  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()
    @parent = {}
  end
end