Whenever I try to run the code below I always get given a "in `rss':
undefined method `parse' 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)