Class: Driskell::Listen::Backend

Inherits:
Object
  • Object
show all
Defined in:
lib/driskell-listen/backend.rb

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Backend.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/driskell-listen/backend.rb', line 9

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 Method Details

#min_delay_between_eventsObject



37
38
39
# File 'lib/driskell-listen/backend.rb', line 37

def min_delay_between_events
  @min_delay_between_events
end

#preempt_change(dir, rel_path, data) ⇒ Object



33
34
35
# File 'lib/driskell-listen/backend.rb', line 33

def preempt_change(dir, rel_path, data)
  adapter.preempt_change dir, rel_path, data
end

#startObject



25
26
27
# File 'lib/driskell-listen/backend.rb', line 25

def start
  adapter.start
end

#stopObject



29
30
31
# File 'lib/driskell-listen/backend.rb', line 29

def stop
  adapter.stop
end