On Wed, 25 Feb 2004 06:20:55 +0900, Mark Hubbart <discord / mac.com>
wrote:

>
>On Feb 23, 2004, at 6:57 AM, Emmanuel Touzery wrote:
>> the ruby code could be simplified:
>> ...
>
>I'm getting into this a little late, but...
>This takes care of it nicely, and looks pretty good:
>
>file, length, name, title = line.chomp.squeeze.split(" | ")

This squeezes everything, not just the name.  But it is still the best
example I've seen so far of the power of Ruby in processing strings.
We do need the regex /\s*\|\s*/ in case we get some data with no space
on one side or the other of the '|' delimiter.

>And, assuming "songs" is an array:
>songs << Song.new(file, length, name, title)
>
>It's difficult to simplify the ("m:ss" => sec) time conversion (while 
>still having it be readable) so I'll just leave that one alone, thank 
>you. :)
>
>--Mark
>
>