[TxMt] Re: Ruby question on TextMate

Marc Chanliau marc.chanliau at gmail.com
Tue Nov 9 21:15:45 UTC 2010


Thanks for the helpful answer. Unfortunately, I'm on Snow Leopard, so the
blog's workaround won't work for me. Adding the snippet you provided works,
but that makes the program break in a regular terminal window, of course.
For now, I'll run Ruby programs asking for user input directly from the
terminal, but that's not cool. Is there a chance to see this feature
supported again in a future TxMate update?
Thanks,
Marc

On Tue, Nov 9, 2010 at 1:00 PM, Dru Kepple <dru at summitprojects.com> wrote:

> On Nov 9, 2010, at 12:01 PM, Marc Chanliau wrote:
>
> I'm a Ruby newbie. I'm using TexMate Version 1.5.9 (1510) on Mac OS X
> Version 10.6.4. I'm trying to write a small Ruby snippet to get keyboard
> input as follows:
>
> puts "What is your name? "
> name = gets.chomp
> puts "Hello #{name}"
>
> I get the following TextMate error:
>
>
> NoMethodError: private method ‘chomp’ called for nil:NilClass
>
> I'm no Ruby expert myself, but the problem you're seeing is that "gets" is
> nil, and therefore has no "chomp" to execute.  "gets" is nil because you
> have no interactive input.  The sad news is thus:
>
> http://blog.macromates.com/2009/interactive-input/
>
> You might try using TextMate's UI library and get a string from the user,
> if that's crucial to your snippet.  A very simple example:
>
> require ENV['TM_SUPPORT_PATH'] + '/lib/ui'
> userInput = TextMate::UI.request_string()
> puts userInput
>
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20101109/7bf33204/attachment-0001.html>


More information about the textmate mailing list