class ThinkingSphinx::Guard::Files
Attributes
names[R]
Public Class Methods
call(names, &block)
click to toggle source
# File lib/thinking_sphinx/guard/files.rb, line 2 def self.call(names, &block) new(names).call(&block) end
new(names)
click to toggle source
# File lib/thinking_sphinx/guard/files.rb, line 6 def initialize(names) @names = names end
Public Instance Methods
call(&block)
click to toggle source
# File lib/thinking_sphinx/guard/files.rb, line 10 def call(&block) return if unlocked.empty? unlocked.each &:lock block.call unlocked.collect(&:name) rescue => error raise error ensure unlocked.each &:unlock end
Private Instance Methods
log_lock(file)
click to toggle source
# File lib/thinking_sphinx/guard/files.rb, line 25 def log_lock(file) ThinkingSphinx::Logger.log :guard, "Guard file for index #{file.name} exists, not indexing: #{file.path}." end
unlocked()
click to toggle source
# File lib/thinking_sphinx/guard/files.rb, line 30 def unlocked @unlocked ||= names.collect { |name| ThinkingSphinx::Guard::File.new name }.reject { |file| log_lock file if file.locked? file.locked? } end