Class: MetricFu::Cli::MicroOptParse::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/metric_fu/cli/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Parser

Returns a new instance of Parser.

Yields:

  • (_self)

Yield Parameters:



9
10
11
12
13
14
# File 'lib/metric_fu/cli/parser.rb', line 9

def initialize
  @options = []
  @used_short = []
  @default_values = nil
  yield self if block_given?
end

Instance Attribute Details

Returns the value of attribute banner.



8
9
10
# File 'lib/metric_fu/cli/parser.rb', line 8

def banner
  @banner
end

#versionObject

Returns the value of attribute version.



8
9
10
# File 'lib/metric_fu/cli/parser.rb', line 8

def version
  @version
end

Instance Method Details

#option(name, desc, settings = {}) ⇒ Object



21
22
23
# File 'lib/metric_fu/cli/parser.rb', line 21

def option(name, desc, settings = {})
  @options << [name, desc, settings]
end

#process!(arguments = ARGV) ⇒ Object



16
17
18
19
# File 'lib/metric_fu/cli/parser.rb', line 16

def process!(arguments = ARGV)
  parser = build_option_parser
  process_options(parser, arguments)
end