Parent

FeedNormalizer::Parser

The root parser object. Every parser must extend this object.

Public Class Methods

parse(feed, loose) click to toggle source

Parses the given feed, and returns a normalized representation. Returns nil if the feed could not be parsed.

    # File lib/feed-normalizer.rb, line 16
16:     def self.parse(feed, loose)
17:       nil
18:     end
parser() click to toggle source

Parser being used.

    # File lib/feed-normalizer.rb, line 10
10:     def self.parser
11:       nil
12:     end
priority() click to toggle source

Returns a number to indicate parser priority. The lower the number, the more likely the parser will be used first, and vice-versa.

    # File lib/feed-normalizer.rb, line 23
23:     def self.priority
24:       0
25:     end

Protected Class Methods

append_or_set!(value, object, object_function) click to toggle source
    # File lib/feed-normalizer.rb, line 53
53:     def self.append_or_set!(value, object, object_function)
54:       if object.send(object_function).respond_to? :push
55:         object.send(object_function).push(value)
56:       else
57:         object.send(:"#{object_function}=", value)
58:       end
59:     end
map_functions!(mapping, src, dest) click to toggle source

sets value, or appends to an existing value

    # File lib/feed-normalizer.rb, line 32
32:     def self.map_functions!(mapping, src, dest)
33: 
34:       mapping.each do |dest_function, src_functions|
35:         src_functions = [src_functions].flatten # pack into array
36: 
37:         src_functions.each do |src_function|
38:           value = if src.respond_to?(src_function)
39:             src.send(src_function)
40:           elsif src.respond_to?(:has_key?)
41:             src[src_function]
42:           end
43: 
44:           unless value.to_s.empty?
45:             append_or_set!(value, dest, dest_function)
46:             break
47:           end
48:         end
49: 
50:       end
51:     end

Private Class Methods

inherited(subclass) click to toggle source

Callback that ensures that every parser gets registered.

    # File lib/feed-normalizer.rb, line 64
64:     def self.inherited(subclass)
65:       ParserRegistry.register(subclass)
66:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.