Class: Zold::Next

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

Overview

Calculate next score

Instance Method Summary collapse

Constructor Details

#initialize(log: Log::NULL) ⇒ Next

Returns a new instance of Next.



37
38
39
# File 'lib/zold/commands/next.rb', line 37

def initialize(log: Log::NULL)
  @log = log
end

Instance Method Details

#run(args = []) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/zold/commands/next.rb', line 41

def run(args = [])
  @log.debug("Next.run(#{args.join(' ')})")
  opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
    o.banner = "Usage: zold next [options] score
Available options:"
    o.bool '--low-priority',
      'Set the lowest priority to this process',
      default: false
    o.bool '--help', 'Print instructions'
  end
  if opts.help?
    @log.info(opts.to_s)
    return
  end
  calculate(opts)
end