diff options
author | Mauro George <maurogot@gmail.com> | 2015-07-04 16:21:54 -0300 |
---|---|---|
committer | Mauro George <maurogot@gmail.com> | 2015-07-06 09:13:02 -0300 |
commit | 912418fd0d5bed31176486b35e2690afbae122bb (patch) | |
tree | 2e69bff11e37d212208bfae71760ad42804f0d6e /activesupport | |
parent | cc7ef0cf19d9818c6772e77ca4a8d350688b44e8 (diff) | |
download | rails-912418fd0d5bed31176486b35e2690afbae122bb.tar.gz rails-912418fd0d5bed31176486b35e2690afbae122bb.tar.bz2 rails-912418fd0d5bed31176486b35e2690afbae122bb.zip |
Add to RDoc of OrderedOptions the bang info
[ci skip]
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/ordered_options.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb index bc0326473d..45864990ce 100644 --- a/activesupport/lib/active_support/ordered_options.rb +++ b/activesupport/lib/active_support/ordered_options.rb @@ -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 |