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, line 80
def node_finder_option_set(options)
  @website.ext.node_finder.find(options[:opts], @website.tree[options[:ref_alcn]])
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, line 85
def node_list(method_name, options)
  if method_name.kind_of?(Array)
    Webgen::Utils.const_for_name(method_name.first).send(method_name.last, @website, options)
  else
    send(method_name, options)
  end
rescue Exception
  []
end