Class: Zold::Next

Inherits:
Object
  • Object
show all
Defined in:
lib/zold/commands/next.rb

Overview

Calculate next score

Instance Method Summary collapse

Constructor Details

#initialize(log: Log::Quiet.new) ⇒ Next

Returns a new instance of Next.



34
35
36
# File 'lib/zold/commands/next.rb', line 34

def initialize(log: Log::Quiet.new)
  @log = log
end

Instance Method Details

#run(args = []) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/zold/commands/next.rb', line 38

def run(args = [])
  opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
    o.banner = "Usage: zold next [options] score
Available options:"
    o.bool '--help', 'Print instructions'
  end
  if opts.help?
    @log.info(opts.to_s)
    return
  end
  calculate(opts)
end