Class: Texas::OptionParser

Inherits:
Object
  • Object
show all
Includes:
OutputHelper
Defined in:
lib/texas/option_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OutputHelper

#trace, #verbose, #warning

Constructor Details

#initialize(args) ⇒ OptionParser

Returns a new instance of OptionParser.



11
12
13
14
# File 'lib/texas/option_parser.rb', line 11

def initialize(args)
  @args = args
  @options = OpenStruct.new
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



9
10
11
# File 'lib/texas/option_parser.rb', line 9

def args
  @args
end

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/texas/option_parser.rb', line 9

def options
  @options
end

Instance Method Details

#parseObject

Returns a structure describing the options.



18
19
20
21
22
23
24
25
# File 'lib/texas/option_parser.rb', line 18

def parse
  set_default_options
  lookup_and_execute_require_option(args)
  parse_options
  set_contents_template_from_args unless args.empty?
  check_mandatory! if options.check_mandatory_arguments
  options
end