class ThinkingSphinx::Guard::File

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/thinking_sphinx/guard/file.rb, line 6
def initialize(name)
  @name = name
end

Public Instance Methods

lock() click to toggle source
# File lib/thinking_sphinx/guard/file.rb, line 10
def lock
  FileUtils.touch path
end
locked?() click to toggle source
# File lib/thinking_sphinx/guard/file.rb, line 14
def locked?
  File.exists? path
end
path() click to toggle source
# File lib/thinking_sphinx/guard/file.rb, line 18
def path
  @path ||= File.join(
    ThinkingSphinx::Configuration.instance.indices_location,
    "ts-#{name}.tmp"
  )
end
unlock() click to toggle source
# File lib/thinking_sphinx/guard/file.rb, line 25
def unlock
  FileUtils.rm(path) if locked?
end