Module: SolrMakr::BufferInteraction

Extended by:
ActiveSupport::Concern
Included in:
Commands::AbstractCommand, Commands::Execute
Defined in:
lib/solr_makr/meta/buffer_interaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bufferSolrMakr::Commands::Buffer (readonly)



7
8
9
# File 'lib/solr_makr/meta/buffer_interaction.rb', line 7

attr_lazy_reader :buffer do
  build_buffer
end

Instance Method Details

#build_bufferObject



37
38
39
# File 'lib/solr_makr/meta/buffer_interaction.rb', line 37

def build_buffer
  SolrMakr::Commands::Buffer.new
end

#compose_buffer(other, raise_interrupt: true, **options, &on_failure) ⇒ Object

Parameters:

  • other (ActiveInteraction::Base, SolrMakr::BufferInteraction)
  • raise_interrupt (Boolean) (defaults to: true)

    normal behavior for halting with compose

  • options (Hash)

Returns:

  • (Object)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/solr_makr/meta/buffer_interaction.rb', line 15

def compose_buffer(other, raise_interrupt: true, **options, &on_failure)
  outcome = other.run(**options)

  if outcome.kind_of?(SolrMakr::BufferInteraction)
    buffer.import outcome.buffer
  end

  if outcome.valid?
    return outcome.result
  else
    if block_given?
      yield outcome
    end

    if raise_interrupt
      throw :interrupt, outcome.errors
    end

    return nil
  end
end