[TxMt] Re: run_script.rb

James Gray james at grayproductions.net
Mon Aug 25 13:14:29 UTC 2008


On Aug 25, 2008, at 8:07 AM, Charles Turner wrote:

> On Mon, 25 Aug 2008 07:39:26 -0500, James Gray wrote:
>
>>>>  str.send(str.respond_to?(:lines) ? :lines, :to_s).map { … }
>
>> You didn't read my code very well.  Please scroll up and have another
>> look.  :)
>
> Please forgive my ignorance of Ruby. I was confused by the comma after
> :lines, which my Rubies complain about. I substituted a colon, but
> maybe (again) that's not what you're trying to say?

Oops, yeah, that was a typo.  Sorry about that.

You fixed it correctly.  Here's what it should have been:

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

> I read your above as: "if the receiver responds to :lines,  
> send :lines,
> else send :to_s", which in 1.8's case is effectively a NoOp: a
> conversion of a string to a string?

Right.

James Edward Gray II




More information about the textmate mailing list