I have tried using gets and no input dialog pops up. Here is my code:
puts "this is a test" puts gets puts "end of test"
I use Run Ruby, and here is the output:
this is a test puts "this is a test" end of test
Bill
From: William M Shobe shobe@virginia.edu Date: September 29, 2005 10:28:59 AM EDT To: textmate@lists.macromates.com Subject: [TxMt] Input from gets in Ruby Reply-To: TextMate users textmate@lists.macromates.com
Please excuse the simple question, but I am experimenting with TextMate and Ruby. The output from running a Ruby script goes to a stdout window. However, I can't figure out how to get input from the gets method. Is there any way to read from stdin when running a Ruby script from the Run Command>Ruby>Run Ruby menu?
Thanks for any help.
Bill Shobe
From: Sune Foldager cryo@cyanite.org Date: September 29, 2005 12:08:58 PM EDT To: TextMate users textmate@lists.macromates.com Subject: Re: [TxMt] Input from gets in Ruby
<snip> Yes, this happens automatically, but stdin is redirected to read input from a dialog which should pop up whenever your script does a gets or similar.
-- Sune.
<snip>
From: Sune Foldager cryo@cyanite.org Date: September 29, 2005 1:58:10 PM EDT To: Kumar McMillan kumar.mcmillan@gmail.com, TextMate users textmate@lists.macromates.com Subject: Re: [TxMt] Input from gets in Ruby Reply-To: TextMate users textmate@lists.macromates.com
On 29/09/2005, at 19.54, Kumar McMillan wrote:
oh, hehe, it is just the Run Ruby command. Sorry, I thought you meant this was built into TextMate!
Nope :-p, but it's built into the Run Python command also :-).
-- Sune.
On 30/09/2005, at 16.09, William M Shobe wrote:
I have tried using gets and no input dialog pops up. Here is my code:
puts "this is a test" puts gets puts "end of test"
I use Run Ruby, and here is the output:
Works for me -- using latest build (http://get.textmate.org/):
cmd N (new buffer) Paste previous 3 lines option-ctrl-shift R (switch to Ruby) cmd R (Run Ruby)
And this is what I see:
Entering a string and pressing return outputs the strings and finishes the program.