Sha256: e9df5ff00cd1517af1609e3b902646d1049aaefe6673a0e6449a048921a6998b

Contents?: true

Size: 726 Bytes

Versions: 4

Compression:

Stored size: 726 Bytes

Contents

class ThinkingSphinx::RealTime::Callbacks::RealTimeCallbacks <
  ThinkingSphinx::Callbacks

  callbacks :after_save

  def after_save
    return unless real_time_indices?

    real_time_indices.each do |index|
      ThinkingSphinx::RealTime::Transcriber.new(index).copy instance
    end
  end

  private

  def configuration
    ThinkingSphinx::Configuration.instance
  end

  def indices
    @indices ||= configuration.indices_for_references reference
  end

  def real_time_indices?
    real_time_indices.any?
  end

  def real_time_indices
    @real_time_indices ||= indices.select { |index|
      index.is_a? ThinkingSphinx::RealTime::Index
    }
  end

  def reference
    instance.class.name.underscore.to_sym
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thinking-sphinx-3.0.3 lib/thinking_sphinx/real_time/callbacks/real_time_callbacks.rb
thinking-sphinx-3.0.2 lib/thinking_sphinx/real_time/callbacks/real_time_callbacks.rb
thinking-sphinx-3.0.1 lib/thinking_sphinx/real_time/callbacks/real_time_callbacks.rb
thinking-sphinx-3.0.0 lib/thinking_sphinx/real_time/callbacks/real_time_callbacks.rb