From: 7stud -- Date: 2007-11-26T04:44:35+09:00 Subject: Re: Checking File for a line Dejan Dimic wrote: > On Nov 24, 8:58 am, Robert Klemme wrote: >> > > end >> File.to_enum(:foreach,"file.txt").grep(/rx/) {|li| puts li; break} >> >> :-) >> >> Kind regards >> >> robert >> >> -- >> use.inject do |as, often| as.you_can - without end > > That's Ruby beauty, express yourself in a way that suits you the most > and still we all can understand your dialect and enjoy. > Speak for yourself. I found that solution particularly distasteful. It turned a simple, easy to read solution, into a convoluted one-liner mess. And on my system the enumerator solution is 50% slower. But, that seems to be the Ruby Way, so at some point I guess I'll have to drink the koolaid and declare how beautiful solutions like that are. -- Posted via http://www.ruby-forum.com/.