module SolrMakr::BufferInteraction

Public Instance Methods

build_buffer() click to toggle source
# 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) { |outcome| ... } click to toggle source

@param [ActiveInteraction::Base, SolrMakr::BufferInteraction] other @param [Boolean] raise_interrupt normal behavior for halting with compose @param [Hash] options @return [Object]

# 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