class Driskell::Listen::Adapter::SimulatedDarwin::FakeEvent
Attributes
dir[R]
Public Class Methods
new(watched_dir, event)
click to toggle source
# File lib/driskell-listen/adapter/simulated_darwin.rb, line 13 def initialize(watched_dir, event) # NOTE: avoid using event.absolute_name since new API # will need to have a custom recursion implemented # to properly match events to configured directories @real_path = full_path(event).relative_path_from(watched_dir) @dir = "#{Pathname(watched_dir) + dir_for_event(event, @real_path)}/" end
Public Instance Methods
real_path()
click to toggle source
# File lib/driskell-listen/adapter/simulated_darwin.rb, line 21 def real_path @real_path.to_s end
Private Instance Methods
dir?(event)
click to toggle source
# File lib/driskell-listen/adapter/simulated_darwin.rb, line 27 def dir?(event) event.flags.include?(:isdir) end
dir_for_event(event, rel_path)
click to toggle source
# File lib/driskell-listen/adapter/simulated_darwin.rb, line 35 def dir_for_event(event, rel_path) (moved?(event) || dir?(event)) ? rel_path.dirname : rel_path end
full_path(event)
click to toggle source
# File lib/driskell-listen/adapter/simulated_darwin.rb, line 39 def full_path(event) Pathname.new(event.watcher.path) + event.name end
moved?(event)
click to toggle source
# File lib/driskell-listen/adapter/simulated_darwin.rb, line 31 def moved?(event) (event.flags & [:moved_to, :moved_from]) end