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.



35
36
37
38
# File 'lib/zold/commands/args.rb', line 35

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

Instance Method Details

#takeObject



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

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