Programming Ruby 3.2 (5th Edition): B1.0 page 241, overlapping option -s

@noelrappin

page 241, option_2.rb

I was wondering why nothing happens with option -s without additional parameter :

% ruby -w rubyworld/option_2.rb -s       
"we are sorting by size"

The fact is that "-s", "--size is overlapping -sSORT. With -t instead of -s :

parser.on("-t SORT", "Sort Type") do |value|

now it raises an error, as expected :

% ruby -w rubyworld/option_2.rb -t
rubyworld/option_2.rb:31:in `<main>': missing argument: -t (OptionParser::MissingArgument)

Okay, I think I fixed that… thanks