RSS::Parser trouble

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whenever I try to run the code below I always get given a “in rss': undefined methodparse’ for :Parser:Symbol (NoMethodError)” error.
Anyone
know what is wrong?

require ‘rss/1.0’
require ‘rss/2.0’
def rss(url,link,number)
content = ‘’
open(url) do |s| content = s.read end
@feed = RSS:Parser.parse(content,false)
@items = ‘’
if !@link
i = 0
while i < 5 do
j = i+1
@items = items,j,’. ‘,@feed.items[i],’, ’
i = j
end
return @items
else
x = number.gsub(/\r/,’’)
x = x.gsub(/\n/,’’)
x = x.to_i
x = x -1
@title = @feed.items[x].title
@link = @feed.items[x].link
return @title, ': ', @link
end
end

rss("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml
",false,0)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFGWaXt2vy7v+d+psQRAgXZAKCmBxi4DknkIwrF8AtMH3v27fRX3wCgu1lV
KQ0IdYbZGYaAJVLNrWqrpWs=
=nPUi
-----END PGP SIGNATURE-----

On 5/27/07, Fred P. [email protected] wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whenever I try to run the code below I always get given a “in rss': undefined methodparse’ for :Parser:Symbol (NoMethodError)” error. Anyone
know what is wrong?

@feed = RSS:Parser.parse(content,false)

Four dots (::slight_smile: – RSS::Parser.parse

    @feed = RSS:Parser.parse(content,false)
                ^^^

You need :: here, not :

-Doug

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs