Class: Rico::Collection
- Inherits:
-
Object
- Object
- Rico::Collection
- Extended by:
- Forwardable
- Includes:
- Enumerable, Object
- Defined in:
- lib/rico/collection.rb
Instance Attribute Summary
Attributes included from Object
Instance Method Summary collapse
-
#add(items) ⇒ Object
Adds the requested items to the array and stores the object.
-
#member?(item) ⇒ Boolean
Tests whether or not an item exists in the array.
-
#remove(items) ⇒ Object
Removes the requested items from the array and stores the object.
Methods included from Object
#data, #exists?, #initialize, #mutate
Instance Method Details
#add(items) ⇒ Object
Adds the requested items to the array and stores the object
items - items to be added to the array
Returns the result of the store operation
14 15 16 |
# File 'lib/rico/collection.rb', line 14 def add(items) mutate build_map_add(items) end |
#member?(item) ⇒ Boolean
Tests whether or not an item exists in the array
item - item to test against
Returns true or false
32 33 34 |
# File 'lib/rico/collection.rb', line 32 def member?(item) members.include? item end |
#remove(items) ⇒ Object
Removes the requested items from the array and stores the object
items - items to be removed from the array
Returns the result of the store operation
23 24 25 |
# File 'lib/rico/collection.rb', line 23 def remove(items) mutate build_map_remove(items) end |