Module: Humanoid::Extensions::Array::Accessors
- Included in:
- Array
- Defined in:
- lib/humanoid/extensions/array/accessors.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#update(attributes) ⇒ Object
(also: #merge!)
If the attributes already exists in the array then they will be updated, otherwise they will be appended.
Instance Method Details
#update(attributes) ⇒ Object Also known as: merge!
If the attributes already exists in the array then they will be updated, otherwise they will be appended.
8 9 10 11 |
# File 'lib/humanoid/extensions/array/accessors.rb', line 8 def update(attributes) delete_if { |e| attributes["_id"] && (e["_id"] == attributes["_id"]) } self.<< attributes end |