Class: Webgen::PathHandler::Feed::Node

Inherits:
PageUtils::Node show all
Defined in:
lib/webgen/path_handler/feed.rb

Overview

Provides custom methods needed for feed nodes.

Instance Attribute Summary

Attributes inherited from Node

#acn, #alcn, #children, #cn, #dest_path, #lang, #lcn, #level, #meta_info, #node_info, #parent, #tree

Instance Method Summary collapse

Methods inherited from PageUtils::Node

#blocks, #render_block, #template_chain

Methods inherited from Base::Node

#content, #link_to, #route_to, #url

Methods inherited from Node

#=~, #[], #initialize, #inspect, #is_ancestor_of?, #is_directory?, #is_file?, #is_fragment?, #is_root?, #link_to, #proxy_node, #resolve, #route_to, #to_s, #versions

Constructor Details

This class inherits a constructor from Webgen::Node

Instance Method Details

#entry_content(entry) ⇒ Object

Return the content of an entry (a Node object) of this feed node.



41
42
43
44
45
46
47
48
49
# File 'lib/webgen/path_handler/feed.rb', line 41

def entry_content(entry)
  block_name = self['content_block_name'] || 'content'
  if entry.respond_to?(:render_block) && entry.blocks[block_name]
    entry.render_block(block_name, Webgen::Context.new(tree.website, :chain => [entry])).content
  else
    tree.website.logger.warn { "Feed entry <#{entry}> not used, is not a renderable node" }
    ''
  end
end

#feed_entriesObject

Return the entries for this feed node.



31
32
33
# File 'lib/webgen/path_handler/feed.rb', line 31

def feed_entries
  tree.website.ext.node_finder.find(self['entries'], self)
end

Return the feed link URL for this feed node.



36
37
38
# File 'lib/webgen/path_handler/feed.rb', line 36

def feed_link
  tree[self['link']].url
end