Class: LiveSoccer::MatchCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/live_soccer/match_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ MatchCollection

Returns a new instance of MatchCollection.



6
7
8
9
10
11
# File 'lib/live_soccer/match_collection.rb', line 6

def initialize(attrs)
  self.matches = []
  attrs.each do |match_attrs|
    self.matches << Match.new(match_attrs)
  end
end

Instance Attribute Details

#matchesObject

Returns the value of attribute matches.



4
5
6
# File 'lib/live_soccer/match_collection.rb', line 4

def matches
  @matches
end

Instance Method Details

#to_sObject



13
14
15
16
# File 'lib/live_soccer/match_collection.rb', line 13

def to_s
  return "Sorry, but looks like no one is on the pitch right now..." if self.matches.empty?
  self.matches.map(&:to_s).join "\n"
end