Class: ActiveSupport::OrderedOptions

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

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from OrderedHash

#delete, #has_key?, #has_value?, #keys, #to_hash, #values

Methods included from CoreExtensions::Array::RandomAccess

#rand

Methods included from CoreExtensions::Array::Grouping

#in_groups, #in_groups_of, #split

Methods included from CoreExtensions::Array::ExtractOptions

#extract_options!

Methods included from CoreExtensions::Array::Conversions

included, #to_formatted_s, #to_param, #to_query, #to_sentence, #to_xml

Methods included from CoreExtensions::Array::Access

#fifth, #forty_two, #fourth, #from, #second, #third, #to

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