提交 c9ca063f 编写于 作者: R Robin Dupret

Merge pull request #20778 from maurogeorge/ordered_options_bang_doc

Add to RDoc of OrderedOptions the bang info [ci skip]
......@@ -6,6 +6,7 @@ module ActiveSupport
# h[:girl] = 'Mary'
# h[:boy] # => 'John'
# h[:girl] # => 'Mary'
# h[:dog] # => nil
#
# Using +OrderedOptions+, the above code could be reduced to:
#
......@@ -14,6 +15,13 @@ module ActiveSupport
# h.girl = 'Mary'
# h.boy # => 'John'
# h.girl # => 'Mary'
# h.dog # => nil
#
# To raise an exception when the value is blank, append a
# bang to the key name, like:
#
# h.dog! # => raises KeyError
#
class OrderedOptions < Hash
alias_method :_get, :[] # preserve the original #[] method
protected :_get # make it protected
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册