Sha256: 7424ab4a28772bed5cbb5dc4937b7429261fed47f657930b8bae5e82c668cce0
Contents?: true
Size: 964 Bytes
Versions: 1
Compression:
Stored size: 964 Bytes
Contents
module PlaylyfeClient module V2 class Collection attr_reader :game def all @items end def add(item) @items << item end def find(str) (@items.detect {|item| item.id.include?(str)}) end def find_all(str_arr) coll=[] str_arr.each do |str| coll << self.find(str) end coll.compact end def first @items.first end def last @items.last end def to_a @items end def size @items.size end private #shoudl be redefined in subclasses def initialize(game) @game= game @items=[] fill_items([]) end def fill_items(hash_array) hash_array.each do |hash| @items << hash end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
playlyfe_client-1.0.2 | lib/playlyfe_client/v2/collection.rb |