Class: Rico::Collection

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable, Object
Defined in:
lib/rico/collection.rb

Direct Known Subclasses

Array, Map

Instance Attribute Summary

Attributes included from Object

#bucket, #key

Instance Method Summary collapse

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

Returns:

  • (Boolean)


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