Skip to content

Instantly share code, notes, and snippets.

@Jesus
Created May 22, 2019 15:55
Show Gist options
  • Save Jesus/2e75f9a94e3814d2079d7f87f176630c to your computer and use it in GitHub Desktop.
Save Jesus/2e75f9a94e3814d2079d7f87f176630c to your computer and use it in GitHub Desktop.
OptionParser doesn't support symbols as values
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