Class: FeedPortlet

Inherits:
Portlet
  • Object
show all
Defined in:
app/portlets/feed_portlet.rb

Instance Method Summary collapse

Instance Method Details

#renderObject

Raises:

  • (ArgumentError)


4
5
6
7
8
9
10
11
12
13
# File 'app/portlets/feed_portlet.rb', line 4

def render
  raise ArgumentError, "No feed URL specified" if self.url.blank?
  @feed = Feed.find_or_create_by_url(self.url).parsed_contents
  if @portlet.limit.to_i != 0
    @items = @feed.items[0..(@portlet.limit.to_i - 1)]
  else
    @items = @feed.items
  end
  instance_eval(self.code) unless self.code.blank?
end