Sha256: 3460a2d38de1e7001597dc8ee02e0be93b86845c724a96096c62715bb2e0b0ca

Contents?: true

Size: 826 Bytes

Versions: 2

Compression:

Stored size: 826 Bytes

Contents

require 'thinking_sphinx/deltas/default_delta'

module ThinkingSphinx
  module Deltas
    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
        ThinkingSphinx::Deltas::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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thorsson_thinking-sphinx-2.0 lib/thinking_sphinx/deltas.rb
thorsson_thinking-sphinx-1.3.18 lib/thinking_sphinx/deltas.rb