Class: ThinkingSphinx::Processor
- Inherits:
-
Object
- Object
- ThinkingSphinx::Processor
- Defined in:
- lib/thinking_sphinx/processor.rb
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(instance: nil, model: nil, id: nil) ⇒ Processor
constructor
A new instance of Processor.
- #upsert ⇒ Object
Constructor Details
#initialize(instance: nil, model: nil, id: nil) ⇒ Processor
Returns a new instance of Processor.
4 5 6 7 8 9 10 |
# File 'lib/thinking_sphinx/processor.rb', line 4 def initialize(instance: nil, model: nil, id: nil) raise ArgumentError if instance.nil? && (model.nil? || id.nil?) @instance = instance @model = model || instance.class @id = id end |
Instance Method Details
#delete ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/thinking_sphinx/processor.rb', line 12 def delete return if instance&.new_record? indices.each { |index| ThinkingSphinx::Deletion.perform( index, id || instance.public_send(index.primary_key) ) } end |
#upsert ⇒ Object
22 23 24 25 26 |
# File 'lib/thinking_sphinx/processor.rb', line 22 def upsert real_time_indices.each do |index| ThinkingSphinx::RealTime::Transcriber.new(index).copy loaded_instance end end |