Sha256: e2bf93b967f6d133a8b4eba00d8602fe96c7f0ecfa28a2d69aae7829e69e84ad

Contents?: true

Size: 693 Bytes

Versions: 4

Compression:

Stored size: 693 Bytes

Contents

module ThinkingSphinx::Deltas
  def self.config
    ThinkingSphinx::Configuration.instance
  end
  
  def self.processor_for(delta)
    case delta
    when TrueClass
      ThinkingSphinx::Deltas::DefaultDelta
    when Class
      delta
    when String
      delta.constantize
    else
      nil
    end
  end

  def self.resume!
    @suspended = false
  end

  def self.suspend(reference, &block)
    suspend!
    yield
    resume!

    config.indices_for_references(reference).each do |index|
      index.delta_processor.index index
    end
  end

  def self.suspend!
    @suspended = true
  end

  def self.suspended?
    @suspended
  end
end

require 'thinking_sphinx/deltas/default_delta'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thinking-sphinx-3.0.2 lib/thinking_sphinx/deltas.rb
thinking-sphinx-3.0.1 lib/thinking_sphinx/deltas.rb
thinking-sphinx-3.0.0 lib/thinking_sphinx/deltas.rb
thinking-sphinx-3.0.0.rc lib/thinking_sphinx/deltas.rb