Class: ActiveSupport::OrderedOptions

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

Overview

:nodoc:

Constant Summary

Constants inherited from Hash

Hash::MERGER

Constants included from CoreExtensions::Hash::Conversions

CoreExtensions::Hash::Conversions::DISALLOWED_XML_TYPES, CoreExtensions::Hash::Conversions::XML_FORMATTING, CoreExtensions::Hash::Conversions::XML_PARSING, CoreExtensions::Hash::Conversions::XML_TYPE_NAMES

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, #deep_merge!, #deep_symbolize_keys, #except, #slice, #to_json

Methods included from CoreExtensions::Hash::Except

#except, #except!

Methods included from CoreExtensions::Hash::Slice

#slice, #slice!

Methods included from CoreExtensions::Hash::Diff

#diff

Methods included from CoreExtensions::Hash::Conversions

included, #rename_key, #to_query, #to_xml

Methods included from CoreExtensions::Hash::ReverseMerge

#reverse_merge, #reverse_merge!

Methods included from CoreExtensions::Hash::DeepMerge

#deep_merge, #deep_merge!

Methods included from CoreExtensions::Hash::IndifferentAccess

#with_indifferent_access

Methods included from CoreExtensions::Hash::Keys

#assert_valid_keys, #stringify_keys, #stringify_keys!, #symbolize_keys, #symbolize_keys!

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



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

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



7
8
9
# File 'lib/active_support/ordered_options.rb', line 7

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

#[]=(key, value) ⇒ Object



3
4
5
# File 'lib/active_support/ordered_options.rb', line 3

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