Methods

Files

Class/Module Index [+]

Quicksearch

God::Conditions::FileTouched

Condition Symbol :file_touched Type: Poll

Trigger when a specified file is touched.

Paramaters

Required
  +path+ is the path to the file to watch.

Examples

Trigger if 'tmp/restart.txt' file is touched (from a Watch):

on.condition(:file_touched) do |c|
  c.path = 'tmp/restart.txt'
end

Attributes

path[RW]

Public Class Methods

new() click to toggle source
# File lib/god/conditions/file_touched.rb, line 24
def initialize
  super
  self.path = nil
end

Public Instance Methods

test() click to toggle source
# File lib/god/conditions/file_touched.rb, line 35
def test
  if File.exists?(self.path)
    (Time.now - File.mtime(self.path)) <= self.interval
  else
    false
  end
end
valid?() click to toggle source
# File lib/god/conditions/file_touched.rb, line 29
def valid?
  valid = true
  valid &= complain("Attribute 'path' must be specified", self) if self.path.nil?
  valid
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.