class Epi::Triggers::Touch

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/epi/triggers/touch.rb, line 5
def initialize(*args)
  super *args
  update
end

Public Instance Methods

message() click to toggle source
# File lib/epi/triggers/touch.rb, line 16
def message
  "Path '#{path}' was touched"
end
test() click to toggle source
# File lib/epi/triggers/touch.rb, line 10
def test
  ino = @ino; mtime = @mtime
  update
  ino != @ino || mtime != @mtime
end

Private Instance Methods

path() click to toggle source
# File lib/epi/triggers/touch.rb, line 22
def path
  @path ||= Pathname args.first
end
update() click to toggle source
# File lib/epi/triggers/touch.rb, line 26
def update
  @ino, @mtime = begin
    stat = path.stat
    [stat.ino, stat.mtime]
  rescue Errno::ENOENT
    [nil, nil]
  end
end