Created
November 28, 2008 21:07
-
-
Save briandoll/30094 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rss/1.0' | |
require 'rss/2.0' | |
require 'open-uri' | |
require 'socket' | |
module ApplicationHelper | |
def render_rss_feed(url) | |
content = "" | |
open(url, 0) do |s| content = s.read end | |
feed = RSS::Parser.parse(content, false) | |
@link = feed.channel.link | |
@title = feed.channel.title | |
@items = feed.channel.items[0..4] # just use the first five items | |
render :partial => 'home/rss_view' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment