Sha256: 6ff27b653228b50586d0a5f70fe0b6883f7a37ed8c2e6b8956882b10bcd76606

Contents?: true

Size: 267 Bytes

Versions: 13

Compression:

Stored size: 267 Bytes

Contents

require 'optparse'
parser = OptionParser.new
parser.on('-xXXX', {foo: 0, bar: 1}, 'Values for required argument' ) do |value|
  p ['-x', value]
end
parser.on('-y [YYY]', {baz: 2, bat: 3}, 'Values for optional argument') do |value|
  p ['-y', value]
end
parser.parse!

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
optparse-0.6.0 doc/optparse/ruby/explicit_hash_values.rb
optparse-0.5.0 doc/optparse/ruby/explicit_hash_values.rb
cli-option_parser.rb-0.6.0 doc/optparse/ruby/explicit_hash_values.rb
cli-option_parser.rb-0.5.3 doc/optparse/ruby/explicit_hash_values.rb
cli-option_parser.rb-0.5.2 doc/optparse/ruby/explicit_hash_values.rb
cmd-optparse.rb-0.5.2 doc/optparse/ruby/explicit_hash_values.rb
cmd-optparse.rb-0.5.0 doc/optparse/ruby/explicit_hash_values.rb
cmd-optparse.rb-0.1.1 doc/optparse/ruby/explicit_hash_values.rb
cmd-optparse.rb-0.1.0 doc/optparse/ruby/explicit_hash_values.rb
optparse-0.4.0 doc/optparse/ruby/explicit_hash_values.rb
optparse-0.3.1 doc/optparse/ruby/explicit_hash_values.rb
optparse-0.3.0 doc/optparse/ruby/explicit_hash_values.rb
optparse-0.2.0 doc/optparse/ruby/explicit_hash_values.rb