R
RichardOnRails
Hi,
I'm using Example: http://rubylearning.com/satishtalim/ruby_arrays.html
as a guide to GetoptLong usage. I get the message:
uninitialized constant GetoptLong::OptionalArgument (NameError)
for line 10 of the program listed below (with line 10 flagged). Can
anyone point me to a working example of GetoptsLong usage?
Thanks in Advance,
Richard
# SummarizeBalances.rb
# K:\_Projects\Ruby\_Ruby_Apps\InvestmentSW
# Example: http://rubylearning.com/satishtalim/ruby_arrays.html
require 'GetoptLong'
puts "Args = " + ARGV.join(", ")
opts = GetoptLong.new(
[ "--from", "-f", GetoptLong::OptionalArgument], # Line 10
[ "--to", "-t", GetoptLong::OptionalArgument],
[ "--weeks_until", "-w", GetoptLong::OptionalArgument]
)
# Process the arguments
opts.each { |opt, arg|
puts %{%s => "%s"} % [opt, arg]
}
rem_args = ARGV.join(", ")
puts "Remaining args = %s" % [rem_args] if rem_args
I'm using Example: http://rubylearning.com/satishtalim/ruby_arrays.html
as a guide to GetoptLong usage. I get the message:
uninitialized constant GetoptLong::OptionalArgument (NameError)
for line 10 of the program listed below (with line 10 flagged). Can
anyone point me to a working example of GetoptsLong usage?
Thanks in Advance,
Richard
# SummarizeBalances.rb
# K:\_Projects\Ruby\_Ruby_Apps\InvestmentSW
# Example: http://rubylearning.com/satishtalim/ruby_arrays.html
require 'GetoptLong'
puts "Args = " + ARGV.join(", ")
opts = GetoptLong.new(
[ "--from", "-f", GetoptLong::OptionalArgument], # Line 10
[ "--to", "-t", GetoptLong::OptionalArgument],
[ "--weeks_until", "-w", GetoptLong::OptionalArgument]
)
# Process the arguments
opts.each { |opt, arg|
puts %{%s => "%s"} % [opt, arg]
}
rem_args = ARGV.join(", ")
puts "Remaining args = %s" % [rem_args] if rem_args