Anyone use "syndication" gem?

K

Kevin Bedell

It's a new gem recently released for handling RSS/Atom feeds.

I've installed it on my powerbook and it's generating an error when I
try to run the example that was included with the package.

I installed it using "gem install syndication" and it installs
correctly. When I try to run the example. I get an error.

The example is:

# RSS Syndication example:
#
# Output Yahoo news headlines, dated.

require 'open-uri'
require 'syndication'

parser = Syndication::RSS::parser.new
feed = nil
open("http://rss.news.yahoo.com/rss/topstories") {|file|
text = file.read
feed = parser.parse(text)
}
chan = feed.channel
t = chan.lastbuilddate.strftime("%H:%I on %A %d %B")
puts "#{chan.title} at #{t}"
for i in feed.items
t = i.pubdate.strftime("%d %b")
puts "#{t}: #{i.title}"
end

The error I get is:

yahoo.rb:7:in `require': No such file to load -- syndication/
rss (LoadError)

I tried uninstalling and reinstalling the gem. I have installed a few
other gems and am able to access them correctly.
 
W

Wayne Vucenic

Hi Kevin,

I installed Syndication on WindowsXP and tried your example. I got
the same error you got.

I then used a utility to snoop on file system activity, and saw that
require was looking for syndication.rb in the wrong place. The
requires should actually be:

require 'open-uri'
require 'syndication/syndication'
require 'syndication/rss'

With these changes, your example now works OK on my system.

Hope this helps.

Wayne Vucenic
No Bugs Software
"Ruby and C++ Agile Contract Programming in Silicon Valley"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,251
Members
46,850
Latest member
Brightrs

Latest Threads

Top