Class: NBA::Game
- Inherits:
-
Object
- Object
- NBA::Game
- Defined in:
- lib/nba/game.rb
Instance Attribute Summary collapse
-
#away_score ⇒ Object
readonly
Returns the value of attribute away_score.
-
#away_team ⇒ Object
readonly
Returns the value of attribute away_team.
-
#home_score ⇒ Object
readonly
Returns the value of attribute home_score.
-
#home_team ⇒ Object
readonly
Returns the value of attribute home_team.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
-
.all(date = (Time.now.utc - 5 * 60 * 60).strftime("%Y%m%d")) ⇒ Object
Returns an array of Team objects.
Instance Method Summary collapse
Instance Attribute Details
#away_score ⇒ Object (readonly)
Returns the value of attribute away_score.
3 4 5 |
# File 'lib/nba/game.rb', line 3 def away_score @away_score end |
#away_team ⇒ Object (readonly)
Returns the value of attribute away_team.
3 4 5 |
# File 'lib/nba/game.rb', line 3 def away_team @away_team end |
#home_score ⇒ Object (readonly)
Returns the value of attribute home_score.
3 4 5 |
# File 'lib/nba/game.rb', line 3 def home_score @home_score end |
#home_team ⇒ Object (readonly)
Returns the value of attribute home_team.
3 4 5 |
# File 'lib/nba/game.rb', line 3 def home_team @home_team end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/nba/game.rb', line 3 def status @status end |
Class Method Details
.all(date = (Time.now.utc - 5 * 60 * 60).strftime("%Y%m%d")) ⇒ Object
Returns an array of Team objects
18 19 20 21 |
# File 'lib/nba/game.rb', line 18 def self.all(date = (Time.now.utc - 5 * 60 * 60).strftime("%Y%m%d")) games = results_to_game(results_from_espn(date)) print(games) end |
Instance Method Details
#pretty_format(options = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/nba/game.rb', line 23 def pretty_format( = {}) self.status.center([:status_length].to_i + 1) + " - " + \ self.home_team.center([:home_length].to_i + 1) + " " + \ (self.home_score =~ /\d/ ? self.home_score.center(4) : "") + " : " + \ (self.away_score =~ /\d/ ? self.away_score.center(4) : "") + " " + \ self.away_team.center([:away_length].to_i + 1) end |