Hi --

On Thu, 30 Nov 2006, Comfort Eagle wrote:

> James Britt wrote:
>> On 11/29/06, Comfort Eagle <steve / fooworks.com> wrote:
>>
>>> Hmm, ok then.  How could I strip http:// from that string?
>>>
>>> --
>> url = 'http://example.com'
>> url.gsub!( /^http:\/\//i, '')
>>
>>
>>
>> James
>
> Interesting.  Newb Q, I'm sure, but when I put that in a while loop I
> get: "private method `gsub!' called for ..."  /me googles & still
> scratches head.
>
> "
> res.each do |url|
>  puts url.gsub!( /^http:\/\//i, '')
> end
> "

It sounds like you've got something other than strings -- or at least
one thing that isn't a string -- in your array.  gsub(!) is sort of
weird because, even though it's only for strings, every object has the
method.  That's because it's a "top-level" method... and *that's*
because it defaults to operating on $_, the default variable.

Anyway, mainly you just need to figure out what non-string is being
assigned to your url variable.


David

-- 
                   David A. Black | dblack / wobblini.net
Author of "Ruby for Rails"   [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog)        [2] | Co-director, Ruby Central, Inc.   [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com    | [4] http://www.rubycentral.org