class Ecogem::Cli::Args

Attributes

command[R]

Public Class Methods

new(argv) click to toggle source
# File lib/ecogem/cli/args.rb, line 6
def initialize(argv)
  @argv = argv.dup
  parse
end

Public Instance Methods

bundler_args() click to toggle source
# File lib/ecogem/cli/args.rb, line 15
def bundler_args
  @argv
end
options() click to toggle source
# File lib/ecogem/cli/args.rb, line 11
def options
  @options ||= {}
end

Private Instance Methods

extract_options() click to toggle source
# File lib/ecogem/cli/args.rb, line 25
        def extract_options
  %i[file port].each do |key|
    if found = @argv.find_index("--ecogem-#{key}")
      name, value = @argv.slice(found, 2)
      options[key] = value
    end
  end
end
parse() click to toggle source
# File lib/ecogem/cli/args.rb, line 19
        def parse
  @command = @argv.shift
  extract_options
  @argv.freeze
end