Module: Observr::EventHandler::Base Abstract

Includes:
Observable
Included in:
Darwin, Portable, Unix
Defined in:
lib/observr/event_handlers/base.rb

Overview

This module is abstract.

Base functionality mixin, meant to be included in specific event handlers.

Instance Method Summary collapse

Instance Method Details

#listen(monitored_paths) ⇒ undefined

This method is abstract.

Begin watching given paths and enter listening loop. Called by the controller.

Parameters:

  • monitored_paths (Array<Pathname>)

    list of paths the application is currently monitoring.

Returns:

  • (undefined)

Raises:



39
40
41
# File 'lib/observr/event_handlers/base.rb', line 39

def listen(monitored_paths)
  raise AbstractMethod
end

#notify(path, event_type = nil) ⇒ undefined

Notify that a file was modified.

Parameters:

  • path (Pathname, String)

    full path or path relative to current working directory

  • event (Symbol)

    event type.

Returns:

  • (undefined)


25
26
27
28
# File 'lib/observr/event_handlers/base.rb', line 25

def notify(path, event_type = nil)
  changed(true)
  notify_observers(path, event_type)
end

#refresh(monitored_paths) ⇒ undefined

This method is abstract.

Called by the controller when the list of paths monitored by wantchr has changed. It should refresh the list of paths being watched.

Parameters:

  • monitored_paths (Array<Pathname>)

    list of paths the application is currently monitoring.

Returns:

  • (undefined)

Raises:



52
53
54
# File 'lib/observr/event_handlers/base.rb', line 52

def refresh(monitored_paths)
  raise AbstractMethod
end