Class: LiveSoccer::MatchCollection
- Inherits:
-
Object
- Object
- LiveSoccer::MatchCollection
- Defined in:
- lib/live_soccer/match_collection.rb
Instance Attribute Summary collapse
-
#matches ⇒ Object
Returns the value of attribute matches.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ MatchCollection
constructor
A new instance of MatchCollection.
- #to_s ⇒ Object
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
#matches ⇒ Object
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_s ⇒ Object
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 |