On Sat, Jun 12, 2010 at 11:38 AM, Phil Richards
<philliprichards / gmail.com> wrote:
> Several scripts that used to work now don't. I had not used ruby or any
> of
> these scripts for several months. In the meantime i upgraded vista to
> windows 7 (clean install) and decided to install 1.9.1 rather than the
> 1.8.7 i used previously.
>
> And now here's the problem i have:
>
> f = open("http...
> webpage = f.read
> ...
> dump = webpage.sub(%r{<body.*?>(.*?)...
> ...
> # process the rest line-by-line
> dump.each do |eachline| # this line produces this error:
> ... :in `block in <main>': undefined method `each' for
> #<String:0x1f3f620> (NoMethodError)
>
> I guess its telling me dump is a string and you can't do "string".each
> But i don't understand why this--and several similar--scripts DID WORK
> with Ruby 1.8.7 So 1.8.7 would "split up" dump at every newline (CR/LF)
> but 1.9.1 will not...???
>
> Can someone tell me what's going on, and what i should try to get these
> to work
> with 1.9.1?

iota ~ % irb
>> "".methods.grep(/each/)
=> [:each_line, :each_byte, :each_char, :each_codepoint]
>> "".is_a?(Enumerable)
=> false

-- 
Michael Fellinger
CTO, The Rubyists, LLC