Class: NHLScores::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/nhl_scores/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLI

Returns a new instance of CLI.



7
8
9
10
# File 'lib/nhl_scores/cli.rb', line 7

def initialize(*args)
  super
  @games = NHLScores::Games.new
end

Instance Attribute Details

#gamesObject (readonly)

Returns the value of attribute games.



5
6
7
# File 'lib/nhl_scores/cli.rb', line 5

def games
  @games
end

Instance Method Details

#currentObject



21
22
23
24
# File 'lib/nhl_scores/cli.rb', line 21

def current
  games = @games.in_progress(team_abbrev: options['team'])
  output_games(games, 'current')
end

#recentObject



14
15
16
17
# File 'lib/nhl_scores/cli.rb', line 14

def recent
  games = @games.recent(team_abbrev: options['team'])
  output_games(games, 'recent')
end

#upcomingObject



28
29
30
31
# File 'lib/nhl_scores/cli.rb', line 28

def upcoming
  games = @games.upcoming(team_abbrev: options['team'])
  output_games(games, 'upcoming')
end