Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/casual_support/hash/setbang.rb
Instance Method Summary collapse
-
#set!(key, value) ⇒ Hash
Sets a value like Hash#[]=, but returns the modified Hash instead of the value.
Instance Method Details
#set!(key, value) ⇒ Hash
Sets a value like Hash#[]=, but returns the modified Hash instead of the value. Useful with #reduce, and 2x faster than using an equivalent Hash#merge! (see benchmark).
11 12 13 14 |
# File 'lib/casual_support/hash/setbang.rb', line 11 def set!(key, value) self[key] = value self end |