Class: ThinkingSphinx::RealTime::Transcriber
- Inherits:
-
Object
- Object
- ThinkingSphinx::RealTime::Transcriber
- Defined in:
- lib/thinking_sphinx/real_time/transcriber.rb
Instance Method Summary collapse
- #clear_before(time) ⇒ Object
- #copy(*instances) ⇒ Object
-
#initialize(index) ⇒ Transcriber
constructor
A new instance of Transcriber.
Constructor Details
#initialize(index) ⇒ Transcriber
Returns a new instance of Transcriber.
4 5 6 |
# File 'lib/thinking_sphinx/real_time/transcriber.rb', line 4 def initialize(index) @index = index end |
Instance Method Details
#clear_before(time) ⇒ Object
8 9 10 11 12 |
# File 'lib/thinking_sphinx/real_time/transcriber.rb', line 8 def clear_before(time) execute <<~SQL.strip DELETE FROM #{@index.name} WHERE sphinx_updated_at < #{time.to_i} SQL end |
#copy(*instances) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/thinking_sphinx/real_time/transcriber.rb', line 14 def copy(*instances) items = instances.select { |instance| instance.persisted? && copy?(instance) } return unless items.present? delete_existing items insert_replacements items end |