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