class Applause::Runner

Attributes

args[R]
options[R]
parser[R]

Public Class Methods

new(args:, options:, parser: Parser.new) click to toggle source
# File lib/applause/runner.rb, line 7
def initialize(args:, options:, parser: Parser.new)
  @args    = args
  @options = options
  @parser  = parser
end

Public Instance Methods

run() click to toggle source
# File lib/applause/runner.rb, line 13
def run
  run_options(args_list)
end

Private Instance Methods

args_list() click to toggle source
# File lib/applause/runner.rb, line 19
def args_list
  parser.parse(args, options.keys)
end
run_block() click to toggle source
# File lib/applause/runner.rb, line 27
def run_block
  lambda do |item|
    head, *tail = item
    options[head].call(*tail)
  end
end
run_options(args_list) click to toggle source
# File lib/applause/runner.rb, line 23
def run_options(args_list)
  args_list.each &run_block
end