Sha256: 9c8ef80759a5faf91f70b38ef135dc922e3d3e925249633820e567ec2c578003

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 Bytes

Contents

require "listen/adapter/linux"

module ListenMonkey
  module Adapter
    class Linux < Listen::Adapter::Linux
      DEFAULTS = {
        events: [
          :recursive,
          :attrib,
          :create,
          :delete,
          :move,
          :close_write
        ],
        wait_for_delay: 0.1,
        recursive: true,
      }.freeze

      private

      def _configure(directory, &callback)
        require 'rb-inotify'
        @worker ||= ::INotify::Notifier.new
        events = options.events
        events.delete(:recursive) unless options.recursive
        @worker.watch(directory.to_s, *events, &callback)
      rescue Errno::ENOSPC
        abort(INOTIFY_LIMIT_MESSAGE)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
listen_monkey-0.0.1 lib/listen_monkey/adapter/linux.rb