Class: ThinkingSphinx::Guard::Files

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/guard/files.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(names) ⇒ Files

Returns a new instance of Files.



8
9
10
# File 'lib/thinking_sphinx/guard/files.rb', line 8

def initialize(names)
  @names = names
end

Class Method Details

.call(names, &block) ⇒ Object



4
5
6
# File 'lib/thinking_sphinx/guard/files.rb', line 4

def self.call(names, &block)
  new(names).call(&block)
end

Instance Method Details

#call(&block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/thinking_sphinx/guard/files.rb', line 12

def call(&block)
  return if unlocked.empty?

  unlocked.each &:lock
  block.call unlocked.collect(&:name)
rescue => error
  raise error
ensure
  unlocked.each &:unlock
end