Peñá wrote: > From: Tom Cloyd [mailto:tomcloyd / comcast.net] > # I'm playing with various ways of using readline, like > # > # require 'readline' > # puts 'test under way' > # opt = readline( "=--> \n") > # puts( opt) > # > # Nothing works, so far. The code above seems to stop at line > # 2. Or maybe it's 3, but there's no prompt output. > # We surely never get to line 4. > > that is because, the line > > opt = readline( "=--> \n") will call ruby's Kernel.readline and not readline's readline (if i may say that ;-). So, what is happening is that ruby will treat "=--> \n" not as a prompt, but as your input ender, ergo it is waiting for the string "=--> \n" wc you never type obviously. > > you really want > > opt = Readline::readline( "=--> \n") > > > Eg, > > botp@pc4all:~$ cat test.rb > require 'readline' > puts 'test under way' > opt = Readline::readline( "=-->\n") > puts( opt) > > botp@pc4all:~$ ruby test.rb > test under way > =--> > is this ok? > is this ok? > botp@pc4all:~$ > > > kind regards -botp > > > Thanks. This is good. I now know more about "readline" than I thought it possible to know. Another surprising Ruby adventure. Thank for you patience with my great ignorance! t. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tom Cloyd, MS MA, LMHC Private practice Psychotherapist Bellingham, Washington, U.S.A: (360) 920-1226 << tc / tomcloyd.com >> (email) << TomCloyd.com >> (website & psychotherapy weblog) << sleightmind.wordpress.com >> (mental health issues weblog) << directpathdesign.com >> (web site design & consultation) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~