Module: ThinkingSphinx::Deltas

Defined in:
lib/thinking_sphinx/deltas.rb,
lib/thinking_sphinx/deltas/default_delta.rb,
lib/thinking_sphinx/deltas/delayed_delta.rb,
lib/thinking_sphinx/deltas/datetime_delta.rb,
lib/thinking_sphinx/deltas/delayed_delta/job.rb,
lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb,
lib/thinking_sphinx/deltas/delayed_delta/flag_as_deleted_job.rb

Defined Under Namespace

Classes: DatetimeDelta, DefaultDelta, DelayedDelta, DeltaJob, FlagAsDeletedJob, Job

Class Method Summary collapse

Class Method Details

.parse(index) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/thinking_sphinx/deltas.rb', line 7

def self.parse(index)
  delta_option = index.local_options.delete(:delta)
  case delta_option
  when TrueClass, :default
    DefaultDelta.new index, index.local_options
  when :delayed
    DelayedDelta.new index, index.local_options
  when :datetime
    DatetimeDelta.new index, index.local_options
  when FalseClass, nil
    nil
  else
    if delta_option.is_a?(String)
      delta_option = Kernel.const_get(delta_option)
    end
    if delta_option.ancestors.include?(ThinkingSphinx::Deltas::DefaultDelta)
      delta_option.new index, index.local_options
    else
      raise "Unknown delta type"
    end
  end
end