Sha256: 2b76829f492c5cdaad5864269c46ce9308f07f3713ff3d1b6bb5c29556d4013e

Contents?: true

Size: 1.34 KB

Versions: 18

Compression:

Stored size: 1.34 KB

Contents

require 'observer'

module Watchr
  module EventHandler
    class AbstractMethod < Exception #:nodoc:
    end

    # Base functionality mixin meant to be included in specific event handlers.
    module Base
      include Observable

      # Notify that a file was modified.
      #
      # ===== Parameters
      # path<Pathname, String>:: full path or path relative to current working directory
      # event_type<Symbol>:: event type.
      #--
      # #changed and #notify_observers are Observable methods
      def notify(path, event_type = nil)
        changed(true)
        notify_observers(path, event_type)
      end

      # Begin watching given paths and enter listening loop. Called by the controller.
      #
      # Abstract method
      #
      # ===== Parameters
      # monitored_paths<Array(Pathname)>:: list of paths the application is currently monitoring.
      #
      def listen(monitored_paths)
        raise AbstractMethod
      end

      # Called by the controller when the list of paths monitored by wantchr
      # has changed. It should refresh the list of paths being watched.
      #
      # Abstract method
      #
      # ===== Parameters
      # monitored_paths<Array(Pathname)>:: list of paths the application is currently monitoring.
      #
      def refresh(monitored_paths)
        raise AbstractMethod
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
watchr-0.5.9 lib/watchr/event_handlers/base.rb
nestor-0.2.4 vendor/watchr-0.5.7/lib/watchr/event_handlers/base.rb
nestor-0.2.3 vendor/watchr-0.5.7/lib/watchr/event_handlers/base.rb
nestor-0.2.2 vendor/watchr-0.5.7/lib/watchr/event_handlers/base.rb
nestor-0.2.1 vendor/watchr-0.5.7/lib/watchr/event_handlers/base.rb
nestor-0.2.0 vendor/watchr-0.5.7/lib/watchr/event_handlers/base.rb
watchr-0.5.8 lib/watchr/event_handlers/base.rb
smparkes-watchr-0.5.7.8 lib/watchr/event_handlers/base.rb
smparkes-watchr-0.5.7.7 lib/watchr/event_handlers/base.rb
smparkes-watchr-0.5.7.6 lib/watchr/event_handlers/base.rb
smparkes-watchr-0.5.7.4 lib/watchr/event_handlers/base.rb
smparkes-watchr-0.5.7.3 lib/watchr/event_handlers/base.rb
smparkes-watchr-0.5.7.2 lib/watchr/event_handlers/base.rb
smparkes-watchr-0.5.7.1 lib/watchr/event_handlers/base.rb
smparkes-watchr-0.5.7 lib/watchr/event_handlers/base.rb
nestor-0.1.1 vendor/watchr-0.5.7/lib/watchr/event_handlers/base.rb
nestor-0.1.0 vendor/watchr-0.5.7/lib/watchr/event_handlers/base.rb
watchr-0.5.7 lib/watchr/event_handlers/base.rb