Class: XML::Feed::Builder::Rss::Channels

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/xml/libxml/feed/builders/rss.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc) ⇒ Channels

Returns a new instance of Channels.



7
8
9
# File 'lib/xml/libxml/feed/builders/rss.rb', line 7

def initialize(doc)
    @doc = doc
end

Instance Attribute Details

#docObject (readonly)

Returns the value of attribute doc.



5
6
7
# File 'lib/xml/libxml/feed/builders/rss.rb', line 5

def doc
  @doc
end

Instance Method Details

#[](x) ⇒ Object



23
24
25
# File 'lib/xml/libxml/feed/builders/rss.rb', line 23

def [](x)
    return Channel.new(@doc, @doc.root.find('/rss/channel').to_a[x])
end

#create {|node| ... } ⇒ Object

Yields:

  • (node)


11
12
13
14
15
# File 'lib/xml/libxml/feed/builders/rss.rb', line 11

def create
    node = Channel.new(@doc)
    yield node 
    @doc.root << node.node
end

#eachObject



17
18
19
20
21
# File 'lib/xml/libxml/feed/builders/rss.rb', line 17

def each
    @doc.root.find('/rss/channel').each do |x|
        yield Channel.new(@doc, x)
    end
end