Module: Boson::OptionParser::MoreOptionParser

Included in:
Boson::OptionParser
Defined in:
lib/boson/more_option_parser.rb

Instance Method Summary collapse

Instance Method Details

#make_mergeable!(opts) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/boson/more_option_parser.rb', line 18

def make_mergeable!(opts)
  opts.each {|k,v|
    if !v.is_a?(Hash) && !v.is_a?(Symbol)
      opts[k] = {:default=>v}
    end
  }
end

#parse(options, args = ARGV) ⇒ Object

Given options to pass to OptionParser.new, this method parses ARGV and returns the remaining arguments and a hash of parsed options. This is useful for scripts outside of Boson.



7
8
9
10
11
# File 'lib/boson/more_option_parser.rb', line 7

def parse(options, args=ARGV)
  @opt_parser ||= new(options)
  parsed_options = @opt_parser.parse(args)
  [@opt_parser.non_opts, parsed_options]
end

#usageObject

Usage string summarizing options defined in parse



14
15
16
# File 'lib/boson/more_option_parser.rb', line 14

def usage
  @opt_parser.to_s
end