class Webgen::ItemTracker::Nodes

This class is used to track changes to a (nested) list of nodes.

An item for this tracker has to consist of the following fields:

The list of nodes is retrieved in one of two ways, depending on the type of the first field:

For example, consider the following statement:

website.ext.item_tracker.add(some_node, :nodes,
  ["MyModule::MyClass", "my_method"], {:some => 'options'}, :content)

The method will be invoked like this for retrieving the nodes:

MyModule::MyClass.my_method(website, {:some => 'options'})

Public Instance Methods

node_finder_option_set(options) click to toggle source

Use Webgen::NodeFinder to generate a (nested) list of nodes. The options hash has to contain two keys:

  • :opts → the node finder option set

  • :ref_alcn → the alcn of the reference node

   # File lib/webgen/item_tracker/nodes.rb
80 def node_finder_option_set(options)
81   @website.ext.node_finder.find(options[:opts], @website.tree[options[:ref_alcn]])
82 end

Private Instance Methods

node_list(method_name, options) click to toggle source

Return the list of nodes.

   # File lib/webgen/item_tracker/nodes.rb
85 def node_list(method_name, options)
86   if method_name.kind_of?(Array)
87     Webgen::Utils.const_for_name(method_name.first).send(method_name.last, @website, options)
88   else
89     send(method_name, options)
90   end
91 rescue Exception
92   []
93 end