Sha256: efece60f5d8c9cf3824be8b30a1423d92350b5c54f858f86fc7f147e0f8d9dff

Contents?: true

Size: 551 Bytes

Versions: 64

Compression:

Stored size: 551 Bytes

Contents

module God
  module Conditions

    class FileMtime < PollCondition
      attr_accessor :path, :max_age

      def initialize
        super
        self.path = nil
        self.max_age = nil
      end

      def valid?
        valid = true
        valid &= complain("Attribute 'path' must be specified", self) if self.path.nil?
        valid &= complain("Attribute 'max_age' must be specified", self) if self.max_age.nil?
        valid
      end

      def test
        (Time.now - File.mtime(self.path)) > self.max_age
      end
    end

  end
end


Version data entries

64 entries across 64 versions & 18 rubygems

Version Path
resurrected_god-0.14.0 lib/god/conditions/file_mtime.rb
mcproc-2016.2.20 lib/god/conditions/file_mtime.rb
god-0.13.7 lib/god/conditions/file_mtime.rb
god-0.13.6 lib/god/conditions/file_mtime.rb
god-0.13.5 lib/god/conditions/file_mtime.rb
dguettler-god-0.7.13.2 lib/god/conditions/file_mtime.rb
dguettler-god-0.7.13.3 lib/god/conditions/file_mtime.rb
dunedain289-god-0.7.12.1 lib/god/conditions/file_mtime.rb
eric-god-0.7.10 lib/god/conditions/file_mtime.rb
eric-god-0.7.11 lib/god/conditions/file_mtime.rb
eric-god-0.7.12 lib/god/conditions/file_mtime.rb
eric-god-0.7.14 lib/god/conditions/file_mtime.rb
fotonauts-god-0.7.10 lib/god/conditions/file_mtime.rb
fotonauts-god-0.7.12 lib/god/conditions/file_mtime.rb
gordoncww-god-0.7.11.1 lib/god/conditions/file_mtime.rb
jreynolds-god-0.7.13 lib/god/conditions/file_mtime.rb
mathieuravaux-god-0.7.11 lib/god/conditions/file_mtime.rb
mojombo-god-0.7.10 lib/god/conditions/file_mtime.rb
mojombo-god-0.7.11 lib/god/conditions/file_mtime.rb
mojombo-god-0.7.12 lib/god/conditions/file_mtime.rb