Morton Goldberg wrote:
> On Mar 12, 2007, at 1:34 AM, 7stud 7stud wrote:
> 
>> open up a text editor, type in the code, save it, and then run it by
>> typing:
>>
>> ruby myProgram.rb
>>
>> I realize that you could do the same thing in irb, but editing is  
>> easier
>> in a text file.  So, as far as I can tell, you don't ever have to use
>> irb to learn Ruby.  Is there something important about irb that I am
>> missing?
> 
> I don't think you're missing anything. If you use a text editor with
> first-class support for Ruby (e.g., TextMate on OS X), your need for
> irb rapidly approaches zero.
> 
> Irb is often cited as a great way to do exploratory coding such as
> checking on what methods are available to an object. I can do
> exploratory coding without firing up irb because I can evaluate code
> snippets from within a TextMate edit buffer. Here is an example, cut
> from TextMate and pasted here:
> 
> <code>
> (Array.new.methods - Object.new.methods).sort # => ["&", "*", "+",
> "-", "<<", "<=>", "[]", "[]=", "all?", "any?", "assoc", "at",
> "clear", "collect", "collect!", "compact", "compact!", "concat",
> "delete", "delete_at", "delete_if", "detect", "each", "each_index",
> "each_with_index", "empty?", "entries", "fetch", "fill", "find",
> "find_all", "first", "flatten", "flatten!", "grep", "include?",
> "index", "indexes", "indices", "inject", "insert", "join", "last",
> "length", "map", "map!", "max", "member?", "min", "nitems", "pack",
> "partition", "pop", "push", "rassoc", "reject", "reject!", "replace",
> "reverse", "reverse!", "reverse_each", "rindex", "select", "shift",
> "size", "slice", "slice!", "sort", "sort!", "sort_by", "to_ary",
> "transpose", "uniq", "uniq!", "unshift", "values_at", "zip", "|"]
> </code>
> 
> Further, in a TextMate edit buffer, I can highlight any method name
> and get the ri documentation on the method just by hitting ctrl-H. I
> also find it easy to run unit tests and benchmarks from within
> TextMate -- two things I find awkward to do from irb.
> 
> But my point is not to sing the praises of TextMate. I like a lot,
> but there are other editors that can perform the same or similar
> feats. My main point is a really good code editor trumps irb.
> 
> Regards, Morton

Thanks for the response.  I'm actually interested in TextMate as well. 
Do you know if I can create my own auto completion snippets in TextMate. 
For instance, I currently use an editor where I can assign any character 
sequence to a code snippet.  Then if I type the character sequence and 
hit the space bar, the code snippet is entered.  I also use the auto 
completion a lot just for long method names; I type one or two 
characters and hit the space bar, and bang, the method name is inserted. 
It's very easy to add new character sequences and the corresponding code 
I want attached to the character sequence.  It's also an extremely fast 
to have the space bar as the trigger for the auto completion.



-- 
Posted via http://www.ruby-forum.com/.