I am trying to define the options for my Ruby script which sending messages from User A to User B for testing purpose. However I couldn't get it work when some of the option have spaces in the value. For example:
OptionParser.new do |opts|
opts.on("-p", "--params a=A,b=B,c=C", Array, "Parameters to compose the message") do |params|
options.params = params.map { |p| p.split("=") }
end
end
But when I try to specify thing like -p SENDER=foo,RECIPIENT=bar,BODY=foo bar
it just gave me back ["SENDER" => "foo", "RECIPIENT" => "bar", "BODY" => "foo"]
.
I have also tried -p SENDER=foo,RECIPIENT=bar,BODY='foo bar'
but no luck with it either.
Does OptionParser support this scenario?
Thank you!