module Ruhoh::Base::Watchable

Public Class Methods

included(klass) click to toggle source
# File lib/ruhoh/base/watchable.rb, line 2
def self.included(klass)
  klass.__send__(:attr_accessor, :collection)
end
new(collection) click to toggle source
# File lib/ruhoh/base/watchable.rb, line 6
def initialize(collection)
  @collection = collection
end

Public Instance Methods

update(path) click to toggle source
# File lib/ruhoh/base/watchable.rb, line 10
def update(path)
  # Drop the resource namespace
  matcher = File::ALT_SEPARATOR ?
              %r{^.+(#{ File::SEPARATOR }|#{ File::ALT_SEPARATOR })} :
              %r{^.+#{ File::SEPARATOR }}

  collection.touch(path.gsub(matcher, ''))
end