Class: ActiveSupport::OrderedOptions

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

Direct Known Subclasses

InheritableOptions

Instance Method Summary collapse

Methods inherited from OrderedHash

[], #clear, #delete, #delete_if, #each, #each_key, #each_value, #initialize, #initialize_copy, #inspect, #invert, #keys, #merge, #merge!, #reject, #reject!, #replace, #shift, #to_a, #to_hash, #to_yaml, #to_yaml_type, #values

Methods inherited from Hash

#as_json, #assert_valid_keys, #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

This class inherits a constructor from ActiveSupport::OrderedHash

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/active_support/ordered_options.rb', line 13

def method_missing(name, *args)
  if name.to_s =~ /(.*)=$/
    self[$1.to_sym] = args.first
  else
    self[name]
  end
end

Instance Method Details

#[](key) ⇒ Object



9
10
11
# File 'lib/active_support/ordered_options.rb', line 9

def [](key)
  super(key.to_sym)
end

#[]=(key, value) ⇒ Object



5
6
7
# File 'lib/active_support/ordered_options.rb', line 5

def []=(key, value)
  super(key.to_sym, value)
end