Class: QuickListener

Inherits:
Object
  • Object
show all
Defined in:
lib/flickrup/quick_listener.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ QuickListener

Returns a new instance of QuickListener.



7
8
9
10
11
12
13
# File 'lib/flickrup/quick_listener.rb', line 7

def initialize(config)
  @config = config
  @changes = Atomic.new 0
  @mutex = Mutex.new
  @sync = ConditionVariable.new
  @flickup = Flickrup.new(config)
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
# File 'lib/flickrup/quick_listener.rb', line 15

def run
  Thread.new { run_loop }
  Listen.to(@config['watch_dir']) do |modified, added, removed|
    unless modified.empty? && added.empty?
      on_change
    end
  end
end