Class: Zold::Args

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

Overview

Command line args

Instance Method Summary collapse

Constructor Details

#initialize(opts, log) ⇒ Args

Returns a new instance of Args.



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

def initialize(opts, log)
  @opts = opts
  @log = log
end

Instance Method Details

#takeObject



42
43
44
45
46
47
48
49
50
# File 'lib/zold/commands/args.rb', line 42

def take
  if @opts.help?
    @log.info(@opts.to_s)
    return
  end
  args = @opts.arguments.reject { |a| a.start_with?('-') }
  raise 'Try --help' if args.empty?
  args[1..-1]
end