Sha256: 6fd1c6061d8a9955bd783172a4b2c6a794c819e5cc31be4128a3ac60d463d24d

Contents?: true

Size: 839 Bytes

Versions: 2

Compression:

Stored size: 839 Bytes

Contents

module Rico
  class Collection
    include Rico::Object
    include Enumerable
    extend Forwardable

    def_delegators :members, :each, :[], :length, :count

    # 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
    def add(items)
      mutate build_map_add(items)
    end

    # 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
    def remove(items)
      mutate build_map_remove(items)
    end

    # Tests whether or not an item exists in the array
    #
    # item - item to test against
    #
    # Returns true or false
    def member?(item)
      members.include? item
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rico-0.5.0 lib/rico/collection.rb
rico-0.4.0 lib/rico/collection.rb