Usually key value pairs are handled something like this:
h = {}
h[:boy] = 'John'
h[:girl] = 'Mary'
h[:boy] # => 'John'
h[:girl] # => 'Mary'
Using OrderedOptions
, the above code could be reduced to:
h = ActiveSupport::OrderedOptions.new
h.boy = 'John'
h.girl = 'Mary'
h.boy # => 'John'
h.girl # => 'Mary'
Methods
- #
- M
- R
Instance Public methods
[]=(key, value)
Link
method_missing(name, *args)
Link