Class: FeedNormalizer::Entry

Inherits:
Object
  • Object
show all
Includes:
ElementCleaner, ElementEquality, RewriteRelativeLinks, Singular, TimeFix
Defined in:
lib/structures.rb

Overview

Represents a feed item entry. Available fields are:

* content
* description
* title
* date_published
* urls / url
* id
* authors / author
* copyright
* categories

Constant Summary collapse

HTML_ELEMENTS =
[:content, :description, :title]
SIMPLE_ELEMENTS =
[:date_published, :urls, :id, :authors, :copyright, :categories, :last_updated, :enclosures]
BLENDED_ELEMENTS =
[]
ELEMENTS =
HTML_ELEMENTS + SIMPLE_ELEMENTS + BLENDED_ELEMENTS

Instance Method Summary collapse

Methods included from Singular

#method_missing, #respond_to?

Methods included from ElementEquality

#==, #diff, #eql?

Methods included from ElementCleaner

#clean!

Methods included from TimeFix

#reparse

Methods included from RewriteRelativeLinks

#rewrite_relative_links

Constructor Details

#initializeEntry

Returns a new instance of Entry.



185
186
187
188
189
190
191
# File 'lib/structures.rb', line 185

def initialize
  @urls = []
  @authors = []
  @categories = []
  @enclosures = []
  @date_published, @content, @last_updated = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FeedNormalizer::Singular

Instance Method Details

#contentObject



204
205
206
# File 'lib/structures.rb', line 204

def content
  @content = rewrite_relative_links(@content, url)
end

#date_publishedObject



194
195
196
# File 'lib/structures.rb', line 194

def date_published
  @date_published = reparse(@date_published)
end

#last_updatedObject



199
200
201
# File 'lib/structures.rb', line 199

def last_updated
  @last_updated = reparse(@last_updated)
end