Skip to content

Instantly share code, notes, and snippets.

@briandoll
Created November 28, 2008 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briandoll/30094 to your computer and use it in GitHub Desktop.
Save briandoll/30094 to your computer and use it in GitHub Desktop.
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