Class: PlaylyfeClient::V2::Collection
- Inherits:
-
Object
- Object
- PlaylyfeClient::V2::Collection
show all
- Defined in:
- lib/playlyfe_client/v2/collection.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#game ⇒ Object
Returns the value of attribute game.
4
5
6
|
# File 'lib/playlyfe_client/v2/collection.rb', line 4
def game
@game
end
|
Instance Method Details
#add(item) ⇒ Object
10
11
12
|
# File 'lib/playlyfe_client/v2/collection.rb', line 10
def add(item)
@items << item
end
|
#all ⇒ Object
6
7
8
|
# File 'lib/playlyfe_client/v2/collection.rb', line 6
def all
@items
end
|
#each(&block) ⇒ Object
14
15
16
|
# File 'lib/playlyfe_client/v2/collection.rb', line 14
def each &block
@items.each &block
end
|
#find(str) ⇒ Object
18
19
20
|
# File 'lib/playlyfe_client/v2/collection.rb', line 18
def find(str)
(@items.detect {|item| item.id.include?(str)})
end
|
#find_all(str_arr) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/playlyfe_client/v2/collection.rb', line 22
def find_all(str_arr)
coll=[]
str_arr.each do |str|
coll << self.find(str)
end
coll.compact
end
|
#first ⇒ Object
30
31
32
|
# File 'lib/playlyfe_client/v2/collection.rb', line 30
def first
@items.first
end
|
#last ⇒ Object
34
35
36
|
# File 'lib/playlyfe_client/v2/collection.rb', line 34
def last
@items.last
end
|
#size ⇒ Object
42
43
44
|
# File 'lib/playlyfe_client/v2/collection.rb', line 42
def size
@items.size
end
|
#to_a ⇒ Object
38
39
40
|
# File 'lib/playlyfe_client/v2/collection.rb', line 38
def to_a
@items
end
|