Project

General

Profile

Bug #19566 » ruby-op-uri-bug.rb

jgomo3 (Jesús Gómez), 03/31/2023 10:56 PM

 
#!/usr/bin/env ruby

require 'optionparser'
require 'uri'

input = ["--uri", "http://example.com/"]
results = {}
op = OptionParser.new

op.on("--uri URI", URI,
"According to OptionParser doc, 'Anything accepted by URI.parse'") do |v|
results[:uri] = v
end

op.parse(input)

puts "Input: #{input[1]}"
puts "Parsed: #{results[:uri]}"
(1-1/2)