Class: Listen::Backend

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/listen/backend.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(directories, queue, silencer, config) ⇒ Backend

Returns a new instance of Backend.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/listen/backend.rb', line 15

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

Instance Attribute Details

#adapterObject (readonly, private)

Returns the value of attribute adapter.



38
39
40
# File 'lib/listen/backend.rb', line 38

def adapter
  @adapter
end

#min_delay_between_eventsObject (readonly)

Returns the value of attribute min_delay_between_events.



34
35
36
# File 'lib/listen/backend.rb', line 34

def min_delay_between_events
  @min_delay_between_events
end