Sha256: 0e8d980598c1d80122bca05b67fb2cd6ffc9cc6ae1d8250f1e9ef1264a44f54b

Contents?: true

Size: 1.1 KB

Versions: 55

Compression:

Stored size: 1.1 KB

Contents

module Listen
  class Listener
    class Config
      DEFAULTS = {
        # Listener options
        debug: false, # TODO: is this broken?
        wait_for_delay: nil, # NOTE: should be provided by adapter if possible
        relative: false,

        # Backend selecting options
        force_polling: false,
        polling_fallback_message: nil
      }.freeze

      def initialize(opts)
        @options = DEFAULTS.merge(opts)
        @relative = @options[:relative]
        @min_delay_between_events = @options[:wait_for_delay]
        @silencer_rules = @options # silencer will extract what it needs
      end

      def relative?
        @relative
      end

      attr_reader :min_delay_between_events

      attr_reader :silencer_rules

      def adapter_instance_options(klass)
        valid_keys = klass.const_get('DEFAULTS').keys
        Hash[@options.select { |key, _| valid_keys.include?(key) }]
      end

      def adapter_select_options
        valid_keys = %w(force_polling polling_fallback_message).map(&:to_sym)
        Hash[@options.select { |key, _| valid_keys.include?(key) }]
      end
    end
  end
end

Version data entries

55 entries across 48 versions & 9 rubygems

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