You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm stumped on how to make it work in a pretty basic class:
class Watcher
def start
monitor = FSSM::Monitor.new(:directories => true)
monitor.path('test_data/', '**/*') do
update do |base, relative, ftype|
output(relative)
end
create do |base, relative, ftype|
output(relative)
end
# don't really care about delete right now
delete { |base, relative, ftype| puts "DELETED #{relative} (#{ftype})" }
end
monitor.run
end
def output(relative)
puts "WOOT! #{relative}"
end
end
In this relatively contrived case, it seems that in the update and create callbacks, it has no visibility to the instance-level output() method. I'm flummoxed on how to solve this. If I instantiate a new Watcher and do watcher.start it runs fine, but as soon as a file change occurs, all I get is:
undefined local variable or method `output' for /Users/mpatterson/mywatcher/test_data:FSSM::Path (FSSM::CallbackError)
(reposted here from an email exchange between ttilley and myself so that he can update the docs with the explanation he gave me)
The text was updated successfully, but these errors were encountered:
I'm stumped on how to make it work in a pretty basic class:
In this relatively contrived case, it seems that in the update and create callbacks, it has no visibility to the instance-level output() method. I'm flummoxed on how to solve this. If I instantiate a new Watcher and do watcher.start it runs fine, but as soon as a file change occurs, all I get is:
(reposted here from an email exchange between ttilley and myself so that he can update the docs with the explanation he gave me)
The text was updated successfully, but these errors were encountered: