Class: Appload::Options
- Inherits:
-
Object
- Object
- Appload::Options
- Defined in:
- lib/appload/options.rb
Overview
This class handles argument parsing
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
A new instance of Options.
-
#parse_args ⇒ Object
Parsing arguments into hash form.
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
8 9 10 11 |
# File 'lib/appload/options.rb', line 8 def initialize @options = {} parse_args end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/appload/options.rb', line 6 def @options end |
Instance Method Details
#parse_args ⇒ Object
Parsing arguments into hash form
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/appload/options.rb', line 14 def parse_args raise 'Need to specify ipa path' unless ARGV[0] OptionParser.new do |opts| opts. = 'Usage: appload ipa' opts.on('-h', '--help', 'Display usage') do puts 'Usage: appload ipa' exit end @options[:ipa_path] = ARGV[0] end end |