Module: WithEase::ClosedStruct::HashApi
- Included in:
- WithEase::ClosedStruct
- Defined in:
- lib/with_ease/closed_struct/hash_api.rb
Instance Method Summary collapse
Instance Method Details
#merge(hash_like = nil, **keys, &blk) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/with_ease/closed_struct/hash_api.rb', line 8 def merge(hash_like=nil, **keys, &blk) if blk return _merge_with_blk(hash_like, **keys, &blk) end if hash_like _merge(hash_like.to_h.merge(**keys)) else _merge(keys) end end |
#update(hash_like = nil, **keys, &blk) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/with_ease/closed_struct/hash_api.rb', line 20 def update(hash_like=nil, **keys, &blk) if blk return _update_with_blk(hash_like, **keys, &blk) end if hash_like _update(hash_like.to_h.merge(**keys)) else _update(keys) end end |