class Ruboty::Rss::Feed

Attributes

attributes[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/ruboty/rss/feed.rb, line 8
def initialize(attributes)
  @attributes = attributes.stringify_keys
end

Public Instance Methods

from() click to toggle source
# File lib/ruboty/rss/feed.rb, line 20
def from
  attributes['from']
end
id() click to toggle source
# File lib/ruboty/rss/feed.rb, line 12
def id
  attributes['id']
end
new_items() click to toggle source
# File lib/ruboty/rss/feed.rb, line 28
def new_items
  source = open(url) {|f| f.read }
  rss = RSS::Parser.parse(source)
  items = []
  if @last_links
    items = rss.items.reject do |item|
      @last_links.include?(item.link)
    end
  end
  @last_links = rss.items.map {|item| item.link }

  items
end
to() click to toggle source
# File lib/ruboty/rss/feed.rb, line 24
def to
  attributes['to']
end
url() click to toggle source
# File lib/ruboty/rss/feed.rb, line 16
def url
  attributes['url']
end