Sha256: 7ffaaf884218e54320f95764ea1284bff339c35e832a596e57ae74485065f59a

Contents?: true

Size: 410 Bytes

Versions: 3

Compression:

Stored size: 410 Bytes

Contents

# frozen_string_literal: true

class ThinkingSphinx::Guard::File
  attr_reader :name

  def initialize(name)
    @name = name
  end

  def lock
    FileUtils.touch path
  end

  def locked?
    File.exist? 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

3 entries across 3 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-5.5.1 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-5.5.0 lib/thinking_sphinx/guard/file.rb