Sha256: b7c5c8bb980ea07ce714c2918971b92da73c20ae0a700f22f568a514abc18f5f

Contents?: true

Size: 380 Bytes

Versions: 6

Compression:

Stored size: 380 Bytes

Contents

class ThinkingSphinx::Guard::File
  attr_reader :name

  def initialize(name)
    @name = name
  end

  def lock
    FileUtils.touch path
  end

  def locked?
    File.exists? path
  end

  def path
    @path ||= File.join(
      ThinkingSphinx::Configuration.instance.indices_location,
      "ts-#{name}.tmp"
    )
  end

  def unlock
    FileUtils.rm(path) if locked?
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
thinking-sphinx-3.4.2 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-3.4.1 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-3.4.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-3.3.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-3.2.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-3.1.4 lib/thinking_sphinx/guard/file.rb