Class: Traject::Indexer::LastNamedStep

Inherits:
Object
  • Object
show all
Defined in:
lib/traject/indexer.rb

Overview

A convenient way to find, and generate error messages for, the last named step (for helping locate parse errors)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index_steps) ⇒ LastNamedStep

Get the last step for which we have a field_name (e.g., the last to_field, skipping over each_record)



462
463
464
465
466
467
468
469
# File 'lib/traject/indexer.rb', line 462

def initialize(index_steps)
  @step = index_steps.reverse_each.find{|step| step[:field_name]}
  if @step 
    @message = "last successfully parsed field was '#{@step[:field_name]}'"
  else
    @message = "there were no previous named fields successfully parsed"
  end
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



459
460
461
# File 'lib/traject/indexer.rb', line 459

def message
  @message
end

#stepObject

Returns the value of attribute step.



459
460
461
# File 'lib/traject/indexer.rb', line 459

def step
  @step
end