[TxMt] Re: run_script.rb

James Gray james at grayproductions.net
Mon Aug 25 01:08:48 UTC 2008


On Aug 24, 2008, at 7:16 PM, Charles Turner wrote:

> In Ruby.tmbundle/Support/RubyMate, when I run the file "test.rb" using
> the command-R key combination in TextMate, the HTML window produces:
>
> Library/Application
> Support/TextMate/Bundles/Ruby.tmbundle/Support/RubyMate/ 
> run_script.rb:65:in
> `block in ': undefined method `map' for "that\xE2\x80\x99s
> nice\n":String (NoMethodError) from /Library/Application
>
> ...plus the call chain.

In Ruby 1.8, you can map() over the lines in a String.  Ruby 1.9 no  
longer allows this.  Thus, we need a new strategy.

We need something that works in both places, so we need to check for  
the new 1.9 method lines and map() over it instead, if present.  The  
code would be something like:

   str.send(str.respond_to?(:lines) ? :lines, :to_s).map { … }

Hope that helps.

James Edward Gray II


More information about the textmate mailing list