Method: Rupture::Map#update
- Defined in:
- lib/rupture/map.rb
#update(key, fn = nil, *args, &block) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/rupture/map.rb', line 21 def update(key, fn = nil, *args, &block) if fn assoc(key, fn.call(self[key], *args, &block)) else assoc(key, yield(self[key])) end end |