Class: Hscode::InputParser

Inherits:
Object
  • Object
show all
Defined in:
lib/hscode/input_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInputParser

Returns a new instance of InputParser.



7
8
9
# File 'lib/hscode/input_parser.rb', line 7

def initialize
  @options = OpenStruct.new
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/hscode/input_parser.rb', line 5

def options
  @options
end

Instance Method Details

#parse(args) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/hscode/input_parser.rb', line 11

def parse(args)
  option_parser.parse!(args)
  options
rescue OptionParser::InvalidOption,
       OptionParser::InvalidArgument,
       OptionParser::MissingArgument => e
  puts e, "See 'hscode --help'."
  exit 1
end