Created
May 22, 2019 15:55
-
-
Save Jesus/2e75f9a94e3814d2079d7f87f176630c to your computer and use it in GitHub Desktop.
OptionParser doesn't support symbols as values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'optparse' | |
parser = OptionParser.new do |args| | |
args.on("-t", "--test VALUE") do |v| | |
puts "VALUE: '#{v}'" | |
end | |
end | |
parser.parse! ['--test', 'jibiri'] | |
# => OK | |
parser.parse! ['--test', :jibiri] | |
# => undefined method `rindex' for :jibiri:Symbol (NoMethodError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment