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:

  • An array consisting of [class/module name, method name] or a string/symbol specifying a method name

  • Options argument (use an array or hash for multiple arguments)

  • Either :content or :meta_info, depending on whether the content or the meta info of the found nodes should be tracked.

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

  • If it is a string/symbol, it specifies the name of a method on this class. This method has to take the options hash as the only parameter.

  • If it is an array, the array has to contain a class/module name and a method name. The method is invoked with the current Webgen::Website object as first and the options hash as second parameter.

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


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