class Webgen::PathHandler::Base::Node

This is the Node sub class used by the Webgen::PathHandler::Base#create_node method if a path handler class does not specify another Node class.

Public Instance Methods

content() click to toggle source

Return the result of the content method on the associated path handler or nil if the associated path handler does not have a content method.

# File lib/webgen/path_handler/base.rb, line 64
def content
  (@node_info[:path_handler].respond_to?(:content) ? @node_info[:path_handler].content(self) : nil)
end
route_to(node, lang = @lang) click to toggle source

Does exactly the same as Webgen::Node#route_to but also automatically adds the necessary item tracking information.

Calls superclass method Webgen::Node#route_to
# File lib/webgen/path_handler/base.rb, line 45
def route_to(node, lang = @lang)
  tree.website.ext.item_tracker.add(self, :node_meta_info, node)
  tree.website.ext.item_tracker.add(self, :node_meta_info, node.proxy_node(lang))
  super
end
url() click to toggle source

Return the absolute URL of this node.

This method uses the configuration option 'website.base_url' for constructing the absolute URL.

# File lib/webgen/path_handler/base.rb, line 38
def url
  node_url = Webgen::Path.url(dest_path, false)
  node_url.absolute? ? node_url.to_s : File.join(tree.website.config['website.base_url'], dest_path)
end