Class GetOptions
In: lib/getoptions.rb
Parent: Object

Methods

[]   each   has_option?   inspect   new  

Included Modules

Enumerable

Classes and Modules

Class GetOptions::ParseError

External Aliases

inspect -> to_s

Public Class methods

Parse input based on metadata in option_specs.

Examples

  opt = GetOptions.new(%w(help verbose! strarg=s))
  puts "I'm going to go do stuff..." if (opt.verbose)
  ...

Public Instance methods

Returns the value of the specified option. If the option was in the specification but not found in the input data, nill is returned.

Iterate over each parsed option name and value.

Examples

opt.each do |key,val|

  puts "#{key} -> #{val.inspect}"

end

Returns true if the specified key exists in the option input.

Examples

  opt = GetOptions.new(%w(help verbose! strarg=s))
  puts "I'm going to go do stuff..." if (opt.has_option(:verbose))
  puts "I don't exist..." if (opt.has_option(:bogus))
  ...

[Validate]