Sha256: d78682d55f832def816ec269dc4cbb916365ee2a9f8cd93b9845e8403c5b1821

Contents?: true

Size: 1.01 KB

Versions: 54

Compression:

Stored size: 1.01 KB

Contents

require 'listen/adapter'
require 'listen/adapter/base'
require 'listen/adapter/config'

require 'forwardable'

# This class just aggregates configuration object to avoid Listener specs
# from exploding with huge test setup blocks
module Listen
  class Backend
    extend Forwardable

    def initialize(directories, queue, silencer, config)
      adapter_select_opts = config.adapter_select_options

      adapter_class = Adapter.select(adapter_select_opts)

      # Use default from adapter if possible
      @min_delay_between_events = config.min_delay_between_events
      @min_delay_between_events ||= adapter_class::DEFAULTS[:wait_for_delay]
      @min_delay_between_events ||= 0.1

      adapter_opts = config.adapter_instance_options(adapter_class)

      aconfig = Adapter::Config.new(directories, queue, silencer, adapter_opts)
      @adapter = adapter_class.new(aconfig)
    end

    delegate start: :adapter
    delegate stop: :adapter

    attr_reader :min_delay_between_events

    private

    attr_reader :adapter
  end
end

Version data entries

54 entries across 47 versions & 9 rubygems

Version Path
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-2.1.1.0 vendor/bundle/ruby/2.5.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-2.0.4.0 vendor/bundle/ruby/2.5.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-2.0.3.0 vendor/bundle/ruby/2.5.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/backend.rb
comiditaULL-0.1.1 vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/backend.rb
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/backend.rb
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/backend.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/backend.rb