1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/doc/optparse/ruby/custom_converter.rb

9 lines
195 B
Ruby

require 'optparse/date'
parser = OptionParser.new
parser.accept(Complex) do |value|
value.to_c
end
parser.on('--complex COMPLEX', Complex) do |value|
p [value, value.class]
end
parser.parse!