Class: FeedNormalizer::Feed

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

Overview

Represents the root element of a feed. Available fields are:

* title
* description
* id
* last_updated
* copyright
* authors / author
* urls / url
* image
* generator
* items / channel

Constant Summary collapse

HTML_ELEMENTS =

Elements that can contain HTML fragments.

[:title, :description]
SIMPLE_ELEMENTS =

Elements that contain ‘plain’ Strings, with HTML escaped.

[:id, :last_updated, :copyright, :authors, :urls, :image, :generator, :ttl, :skip_hours, :skip_days]
BLENDED_ELEMENTS =

Elements that contain both HTML and escaped HTML.

[:items]
ELEMENTS =
HTML_ELEMENTS + SIMPLE_ELEMENTS + BLENDED_ELEMENTS

Instance Attribute Summary collapse

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

Constructor Details

#initialize(wrapper) ⇒ Feed

Returns a new instance of Feed.



241
242
243
244
245
246
247
248
249
250
# File 'lib/structures.rb', line 241

def initialize(wrapper)
  # set up associations (i.e. arrays where needed)
  @urls = []
  @authors = []
  @skip_hours = []
  @skip_days = []
  @items = []
  @parser = wrapper.parser.to_s
  @last_updated = nil
end

Dynamic Method Handling

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

Instance Attribute Details

#parserObject

Returns the value of attribute parser.



237
238
239
# File 'lib/structures.rb', line 237

def parser
  @parser
end

Instance Method Details

#channelObject



257
# File 'lib/structures.rb', line 257

def channel() self end

#last_updatedObject



253
254
255
# File 'lib/structures.rb', line 253

def last_updated
  @last_updated = reparse(@last_updated)
end