Created
February 3, 2012 12:00
-
-
Save benlangfeld/1729843 to your computer and use it in GitHub Desktop.
I am struggling a little with using $stdin.gets within a Pry session. My use case is a console method presenting a list of numbered options, and then blocking on a choice (an integer) before resuming that method. I'm seeing this: https://gist.github.com/1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
def foo | |
gets | |
end | |
pry |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{11:59}[ruby-1.9.3]~/code/VoIP/adhearsion/testapps/general ben% ruby foo.rb | |
[1] pry(main)> foo | |
1^M^M^M^M^CInterrupt: | |
from foo.rb:4:in `gets' | |
[2] pry(main)> exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ ruby /tmp/bla.rb
Frame number: 0/1
Frame type: eval
From: /tmp/bla.rb @ line 7:
=> 7: pry
8:
[1] pry(main)> foo
HEY WORLD HOW ARE YOU TODAY?
=> "HEY WORLD HOW ARE YOU TODAY?\n"
[2] pry(main)>