From: Robert Klemme Date: 2012-07-25T05:58:01+09:00 Subject: Re: simple optparse question on available options On Tue, Jul 24, 2012 at 9:18 PM, Panagiotis Atmatzidis wrote: > opts.on('-s', '--sort OPT', [:date, :country, :ip], 'Sorts by [date, country, ip-frequency]') do |sort| > options[:sort] = sort > end > [...] > # opts.on('-s', '--sort OPT', [:date, :country, :ip], 'Sorts by [date, country, ip-frequency]') do |sort| > elsif options[:sort] > if options[:sort] == 'date' > $f2b.sort_by_date > elsif options[:sort] == "country" # <--- something like this? > # etc... > [...] > > Any sort of hints are always welcome. $ irb19 -r optparse irb(main):001:0> OptionParser.new {|o| o.on("-s O", [:a, :b]){|v| p v, v.class}}.parse %w{-s a} :a Symbol => [] Nice pun, btw. :-) Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/