Jon Garvin
11/29/2006 5:13:00 PM
Try...
files = [ARGV].to_s
files.gsub!(/\-/, "..")
puts files
However, I *think* that ARGV is already a string? so that to_s in the first line may be redundant.
Your problem was that, although gsub! (with the !) normally modifies the receiver, 'files' wasn't the receiver (to_s was), so you weren't actually changing 'files'.
Peter Bailey wrote:
> Hello,
> I'm going nuts with the simplest stuff here. I just want to take in
> array data and make it into a range.
>
> Here's my test script, called test1.rb:
> files = [ARGV]
> files.to_s.gsub!(/\-/, "..")
> puts files
>
>
> Here's my attempt, with an argument:
> test1.rb im123000-im123006
>
> I get:
> im123000-im123006
>
> I want:
> im123000..im123006
>
> Thanks,
> Peter
>
>