Class: Chewy::Index::Import::JournalBuilder
- Inherits:
-
Object
- Object
- Chewy::Index::Import::JournalBuilder
- Defined in:
- lib/chewy/index/import/journal_builder.rb
Instance Method Summary collapse
- #bulk_body ⇒ Object
-
#initialize(index, to_index: [], delete: []) ⇒ JournalBuilder
constructor
A new instance of JournalBuilder.
Constructor Details
#initialize(index, to_index: [], delete: []) ⇒ JournalBuilder
Returns a new instance of JournalBuilder.
5 6 7 8 9 |
# File 'lib/chewy/index/import/journal_builder.rb', line 5 def initialize(index, to_index: [], delete: []) @index = index @to_index = to_index @delete = delete end |
Instance Method Details
#bulk_body ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/chewy/index/import/journal_builder.rb', line 11 def bulk_body Chewy::Index::Import::BulkBuilder.new( Chewy::Stash::Journal, to_index: [ entries(:index, @to_index), entries(:delete, @delete) ].compact ).bulk_body.each do |item| item.values.first.merge!( _index: Chewy::Stash::Journal.index_name ) end end |