Module: XML::Feed::Parser::Rss::Common

Included in:
Channel, Item
Defined in:
lib/xml/libxml/feed/parsers/rss/common.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(methId, *args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/xml/libxml/feed/parsers/rss/common.rb', line 8

def method_missing(methId, *args)
    requested = @node.find("./#{methId.to_s}")
    if requested.first
        if requested.length > 1
            array = []
            requested.each do |x|
                array.push XML::Feed::Parser::Tag.new(x.name, type_node(x), x.properties)
            end

            return array
        else
            r = requested.first
            return XML::Feed::Parser::Tag.new(r.name, type_node(r), r.properties)
        end
    end

    return nil
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



2
3
4
# File 'lib/xml/libxml/feed/parsers/rss/common.rb', line 2

def node
  @node
end

Instance Method Details

#initialize(node) ⇒ Object



4
5
6
# File 'lib/xml/libxml/feed/parsers/rss/common.rb', line 4

def initialize(node)
    @node = node
end