Module: ThinkingSphinx::Deltas

Defined in:
lib/thinking_sphinx/deltas.rb

Defined Under Namespace

Classes: DefaultDelta, DeleteJob, IndexJob

Class Method Summary collapse

Class Method Details

.configObject



2
3
4
# File 'lib/thinking_sphinx/deltas.rb', line 2

def self.config
  ThinkingSphinx::Configuration.instance
end

.processor_for(delta) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/thinking_sphinx/deltas.rb', line 6

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

.resume!Object



19
20
21
# File 'lib/thinking_sphinx/deltas.rb', line 19

def self.resume!
  @suspended = false
end

.suspend(reference, &block) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/thinking_sphinx/deltas.rb', line 23

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

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

.suspend!Object



33
34
35
# File 'lib/thinking_sphinx/deltas.rb', line 33

def self.suspend!
  @suspended = true
end

.suspended?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/thinking_sphinx/deltas.rb', line 37

def self.suspended?
  @suspended
end