Class: Traject::Indexer::Context

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

Overview

Represents the context of a specific record being indexed, passed to indexing logic blocks

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash_init = {}) ⇒ Context

Returns a new instance of Context.



423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/traject/indexer.rb', line 423

def initialize(hash_init = {})
  # TODO, argument checking for required args?

  self.clipboard   = {}
  self.output_hash = {}

  hash_init.each_pair do |key, value|
    self.send("#{key}=", value)
  end

  @skip = false
end

Instance Attribute Details

#clipboardObject

Returns the value of attribute clipboard.



436
437
438
# File 'lib/traject/indexer.rb', line 436

def clipboard
  @clipboard
end

#index_stepObject

Returns the value of attribute index_step.



437
438
439
# File 'lib/traject/indexer.rb', line 437

def index_step
  @index_step
end

#loggerObject

Returns the value of attribute logger.



436
437
438
# File 'lib/traject/indexer.rb', line 436

def logger
  @logger
end

#output_hashObject

Returns the value of attribute output_hash.



436
437
438
# File 'lib/traject/indexer.rb', line 436

def output_hash
  @output_hash
end

#positionObject

1-based position in stream of processed records.



439
440
441
# File 'lib/traject/indexer.rb', line 439

def position
  @position
end

#settingsObject

Returns the value of attribute settings.



437
438
439
# File 'lib/traject/indexer.rb', line 437

def settings
  @settings
end

#skipmessageObject

Should we be skipping this record?



442
443
444
# File 'lib/traject/indexer.rb', line 442

def skipmessage
  @skipmessage
end

#source_recordObject

Returns the value of attribute source_record.



437
438
439
# File 'lib/traject/indexer.rb', line 437

def source_record
  @source_record
end

Instance Method Details

#skip!(msg = '(no message given)') ⇒ Object

Set the fact that this record should be skipped, with an optional message



446
447
448
449
# File 'lib/traject/indexer.rb', line 446

def skip!(msg = '(no message given)')
  @skipmessage = msg
  @skip = true
end

#skip?Boolean

Should we skip this record?

Returns:

  • (Boolean)


452
453
454
# File 'lib/traject/indexer.rb', line 452

def skip?
  @skip
end