Class: ActiveSupport::OrderedOptions

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

Overview

:nodoc:

Direct Known Subclasses

InheritableOptions

Instance Method Summary collapse

Methods inherited from OrderedHash

[], #clear, #delete, #delete_if, #each, #each_key, #each_pair, #each_value, #encode_with, #extractable_options?, #initialize, #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

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



32
33
34
35
36
37
38
# File 'lib/active_support/ordered_options.rb', line 32

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

Instance Method Details

#[](key) ⇒ Object



28
29
30
# File 'lib/active_support/ordered_options.rb', line 28

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

#[]=(key, value) ⇒ Object



24
25
26
# File 'lib/active_support/ordered_options.rb', line 24

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

#respond_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/active_support/ordered_options.rb', line 40

def respond_to?(name)
  true
end