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.



173
174
175
176
177
178
179
# File 'lib/structures.rb', line 173

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

Dynamic Method Handling

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

Instance Method Details

#contentObject



187
188
189
# File 'lib/structures.rb', line 187

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

#date_publishedObject



182
183
184
# File 'lib/structures.rb', line 182

def date_published
  @date_published = reparse(@date_published)
end