Sha256: cccec3f4fc7d3fcf9ee7f9f9403b14db745453fd2ac8965325807ac2183ad43c

Contents?: true

Size: 957 Bytes

Versions: 1

Compression:

Stored size: 957 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'webgen/item_tracker'

module Webgen
  class ItemTracker

    # This class is used to track changes to the content of a node. The content of a node is changed
    # if any of its dependencies are changed.
    #
    # The item for this tracker is the alcn of the node:
    #
    #   website.ext.item_tracker.add(some_node, :node_content, my_node.alcn)
    #
    class NodeContent

      def initialize(website) #:nodoc:
        @website = website
      end

      def item_id(alcn) #:nodoc:
        alcn
      end

      def item_data(alcn) #:nodoc:
        nil
      end

      def item_changed?(alcn, old_data) #:nodoc:
        @website.tree[alcn].nil? || @website.ext.item_tracker.node_changed?(@website.tree[alcn])
      end

      def referenced_nodes(alcn, nothing) #:nodoc:
        [alcn]
      end

      def item_description(alcn, data) #:nodoc:
        "Content from node <#{alcn}>"
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webgen-1.0.0.beta2 lib/webgen/item_tracker/node_content.rb