fix AS::OrderedOptions documentation [ci skip]

This commit is contained in:
Francesco Rodriguez 2012-09-17 00:12:11 -05:00
parent 744b8e0f35
commit c1c9f1c7b9
1 changed files with 15 additions and 16 deletions

View File

@ -1,20 +1,19 @@
# Usually key value pairs are handled something like this:
#
# h = {}
# h[:boy] = 'John'
# h[:girl] = 'Mary'
# h[:boy] # => 'John'
# h[:girl] # => 'Mary'
#
# Using <tt>OrderedOptions</tt>, the above code could be reduced to:
#
# h = ActiveSupport::OrderedOptions.new
# h.boy = 'John'
# h.girl = 'Mary'
# h.boy # => 'John'
# h.girl # => 'Mary'
#
module ActiveSupport #:nodoc:
# Usually key value pairs are handled something like this:
#
# h = {}
# h[:boy] = 'John'
# h[:girl] = 'Mary'
# h[:boy] # => 'John'
# h[:girl] # => 'Mary'
#
# Using <tt>OrderedOptions</tt>, the above code could be reduced to:
#
# h = ActiveSupport::OrderedOptions.new
# h.boy = 'John'
# h.girl = 'Mary'
# h.boy # => 'John'
# h.girl # => 'Mary'
class OrderedOptions < Hash
alias_method :_get, :[] # preserve the original #[] method
protected :_get # make it protected