Sha256: 99495fc89156af34b40698eb57ef0e9e7c6eb11c385b197cb1c1c15e8198aece
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module Rico class Array include Rico::Object include Enumerable extend Forwardable def_delegators :members, :each, :[] public # 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 compute_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 compute_remove(items) end # Obtains the items in the array # # Returns the data in the object as an array def members Array(data) 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 # Returns the number of items in the array # # Returns an Integer def length members.length end alias_method :count, :length protected def compute_add(items) members + items end def compute_remove(items) members - items end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rico-0.0.1 | lib/rico/array.rb |