Type:
Class
Usually key value pairs are handled something like this:
1 2 3 4 5 | h = {} h[ :boy ] = 'John' h[ :girl ] = 'Mary' h[ :boy ] # => 'John' h[ :girl ] # => 'Mary' |
Using OrderedOptions
, the above code could be reduced to:
1 2 3 4 5 | h = ActiveSupport::OrderedOptions. new h.boy = 'John' h.girl = 'Mary' h.boy # => 'John' h.girl # => 'Mary' |