From: Christian Neukirchen Date: 2005-04-23T00:12:05+09:00 Subject: Re: [QUIZ] HighLine (#29) Ruby Quiz writes: > What I really think we need here is to take a page out of the optparse book. > Here are some general ideas: > > age = ask("What is your age?", Integer, :within => 0..105) > num = eval "0b#{ ask( 'Enter a binary number.', > String, :validate => /^[01_]+$/ ) }" Do not ever do that. irb(main):004:0> Integer("0b1011") => 11 irb(main):005:0> "1011".to_i(2) => 11 irb(main):006:0> "foo\nbar" =~ /^foo$/ => 0 -- Christian Neukirchen http://chneukirchen.org