Class: Jakdlugo::CLI

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

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



10
11
12
# File 'lib/jakdlugo.rb', line 10

def initialize
  @app = CourseData.new
end

Instance Method Details

#run(args) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/jakdlugo.rb', line 14

def run(args)
  subcommand, first_arg, second_arg = args.map(&:downcase)

  case subcommand
  when "-c", "--course"   then @app.course_summary(first_arg)
  when "-t", "--track"    then @app.track_summary(first_arg)
  when "-p", "--progress" then @app.progress_summary(first_arg, second_arg)
  else display_help_message
  end
end