[Ruby] FeedNormalizer doesn't get the "updated" field for entries
Patrick Minton
patrick.minton at gmail.com
Mon Feb 4 16:48:35 PST 2008
A colleague told me that FeedNormalizer's author was here in Seattle,
so I thought I'd give this a shot.
I noticed that the implementation of simple-rss in feed-normalizer
doesn't have an entry mapping for the "updated" tag:
# entry elements
entry_mapping = {
:date_published => [:pubDate, :published, :dc_date],
:urls => :link,
:description => [:description, :summary],
:content => [:content, :content_encoded, :description],
:title => :title,
:authors => [:author, :contributor, :dc_creator],
:categories => :category
}
So I added it to the entry mapping, and promptly got a "method
missing" error. It turns out I need to edit structures.rb as well,
because the Entry class doesn't have "updated" in its ELEMENTS:
# Represents a feed item entry.
class Entry
include Singular, ElementEquality, ElementCleaner
HTML_ELEMENTS = [:content, :description, :title]
SIMPLE_ELEMENTS =
[:date_published, :urls, :id, :authors, :copyright, :categories]
BLENDED_ELEMENTS = []
ELEMENTS = HTML_ELEMENTS + SIMPLE_ELEMENTS + BLENDED_ELEMENTS
attr_accessor(*ELEMENTS)
def initialize
@urls = []
@authors = []
@categories = []
end
end
So I added :updated to the entry_mapping hash in simple-rss.rb, and to
the SIMPLE_ELEMENTS array of the Entry class in structures.rb.
*Seems* to work.
Ok, so what's my question?
I'm just curious if this is an artifact of the simple-rss parser lib
being older than the SimpleRSS gem (which *has* an updated method for
its items), or if this was left out intentionally. I'm also wondering
if:
a) this solution is the best one and is sufficient to solve the problem
b) if this could get built into a patch for the gem.
b) would be especially nice because I would rather not freeze the gems
in my rails project, since (so far) this is the only gem I've had to
touch, and I'm using a lot of gems.
if a) is false, I'd love to hear more.
Any feedback would be appreciated.
Thanks,
Patrick
More information about the Ruby
mailing list