Sha256: 3abb57737921c82a54b606bbd25e79db1622f09b86d0ab69965843dc3ca7d981

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

require 'thinking_sphinx/deltas/default_delta'
require 'thinking_sphinx/deltas/delayed_delta'
require 'thinking_sphinx/deltas/datetime_delta'

module ThinkingSphinx
  module Deltas
    def self.parse(index, options)
      delta_option = options.delete(:delta)
      case delta_option
      when TrueClass, :default
        DefaultDelta.new index, options
      when :delayed
        DelayedDelta.new index, options
      when :datetime
        DatetimeDelta.new index, options
      when FalseClass, nil
        nil
      else
        if delta_option.class == String
          begin
            delta_option = eval(delta_option)
          rescue
          end
        end
        if delta_option.ancestors.include?(ThinkingSphinx::Deltas::DefaultDelta)
          delta_option.new index, options
        else
          raise "Unknown delta type"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lostboy-thinking-sphinx-1.1.5.5 lib/thinking_sphinx/deltas.rb