Class: Cukunity::CLI::ArgumentParser

Inherits:
Object
  • Object
show all
Defined in:
lib/cukunity/cli/argument_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ ArgumentParser

Returns a new instance of ArgumentParser.



16
17
18
# File 'lib/cukunity/cli/argument_parser.rb', line 16

def initialize(args)
  @args = args.dup
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



6
7
8
# File 'lib/cukunity/cli/argument_parser.rb', line 6

def args
  @args
end

#commandObject (readonly)

Returns the value of attribute command.



9
10
11
# File 'lib/cukunity/cli/argument_parser.rb', line 9

def command
  @command
end

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/cukunity/cli/argument_parser.rb', line 8

def options
  @options
end

#remaining_argsObject (readonly)

Returns the value of attribute remaining_args.



7
8
9
# File 'lib/cukunity/cli/argument_parser.rb', line 7

def remaining_args
  @remaining_args
end

Class Method Details

.parse(args) ⇒ Object



11
12
13
14
# File 'lib/cukunity/cli/argument_parser.rb', line 11

def self.parse(args)
  parser = new(args)
  parser.parse
end

Instance Method Details

#parseObject



20
21
22
23
# File 'lib/cukunity/cli/argument_parser.rb', line 20

def parse
  parse_options
  parse_command
end