Sha256: 48023586239f9e6c92e548f2424dc23ec94c6cf90c8bc62ebd7a2fa5df40d70a

Contents?: true

Size: 871 Bytes

Versions: 17

Compression:

Stored size: 871 Bytes

Contents

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

require 'webgen/item_tracker'

module Webgen
  class ItemTracker

    # This class is used to track changes to a file.
    #
    # The item for this tracker is the name of the file, i.e. add an item like this:
    #
    #   website.ext.item_tracker.add(some_node, :file, '/home/me/file.jpg')
    #
    class File

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

      def item_id(filename) #:nodoc:
        filename
      end

      def item_data(filename) #:nodoc:
        ::File.mtime(filename)
      end

      def item_changed?(filename, old_mtime) #:nodoc:
        ::File.mtime(filename) > old_mtime
      end

      def referenced_nodes(filename, mtime) #:nodoc:
        []
      end

      def item_description(filename, data) #:nodoc:
        "Content from file '#{filename}'"
      end

    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
webgen-1.7.3 lib/webgen/item_tracker/file.rb
webgen-1.7.2 lib/webgen/item_tracker/file.rb
webgen-1.7.1 lib/webgen/item_tracker/file.rb
webgen-1.7.0 lib/webgen/item_tracker/file.rb
webgen-1.6.0 lib/webgen/item_tracker/file.rb
webgen-1.5.2 lib/webgen/item_tracker/file.rb
webgen-1.5.1 lib/webgen/item_tracker/file.rb
webgen-1.5.0 lib/webgen/item_tracker/file.rb
webgen-1.4.1 lib/webgen/item_tracker/file.rb
webgen-1.4.0 lib/webgen/item_tracker/file.rb
webgen-1.3.0 lib/webgen/item_tracker/file.rb
webgen-1.2.1 lib/webgen/item_tracker/file.rb
webgen-1.2.0 lib/webgen/item_tracker/file.rb
webgen-1.1.0 lib/webgen/item_tracker/file.rb
webgen-1.0.0 lib/webgen/item_tracker/file.rb
webgen-1.0.0.beta3 lib/webgen/item_tracker/file.rb
webgen-1.0.0.beta2 lib/webgen/item_tracker/file.rb