Class: ActiveSupport::InheritableOptions

Inherits:
OrderedOptions show all
Defined in:
lib/active_support/ordered_options.rb

Direct Known Subclasses

Configurable::Configuration

Instance Method Summary collapse

Methods inherited from OrderedOptions

#[], #[]=, #method_missing, #respond_to?

Methods inherited from OrderedHash

[], #[]=, #clear, #delete, #delete_if, #each, #each_key, #each_pair, #each_value, #encode_with, #extractable_options?, #initialize_copy, #inspect, #invert, #keys, #merge, #merge!, #nested_under_indifferent_access, #reject, #reject!, #replace, #shift, #to_a, #to_hash, #to_yaml, #to_yaml_type, #values

Methods inherited from Hash

#as_json, #assert_valid_keys, #deep_dup, #deep_merge, #deep_merge!, #diff, #encode_json, #except, #except!, #extract!, #extractable_options?, from_xml, #reverse_merge, #reverse_merge!, #slice, #slice!, #stringify_keys, #stringify_keys!, #symbolize_keys, #symbolize_keys!, #to_param, #to_xml, #with_indifferent_access

Constructor Details

#initialize(parent = nil) ⇒ InheritableOptions

Returns a new instance of InheritableOptions.



46
47
48
49
50
51
52
53
54
55
# File 'lib/active_support/ordered_options.rb', line 46

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveSupport::OrderedOptions

Instance Method Details

#inheritable_copyObject



57
58
59
# File 'lib/active_support/ordered_options.rb', line 57

def inheritable_copy
  self.class.new(self)
end