Class: NcsNavigator::Warehouse::Transformers::EnumTransformer::ForeignKeyChecker

Inherits:
Object
  • Object
show all
Includes:
RecordIdent
Defined in:
lib/ncs_navigator/warehouse/transformers/enum_transformer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RecordIdent

#record_ident

Constructor Details

#initialize(log, fk_index) ⇒ ForeignKeyChecker

Returns a new instance of ForeignKeyChecker.



266
267
268
269
# File 'lib/ncs_navigator/warehouse/transformers/enum_transformer.rb', line 266

def initialize(log, fk_index)
  @log = log
  @fk_index = fk_index
end

Instance Attribute Details

#fk_indexObject (readonly)

Returns the value of attribute fk_index.



264
265
266
# File 'lib/ncs_navigator/warehouse/transformers/enum_transformer.rb', line 264

def fk_index
  @fk_index
end

#logObject (readonly)

Returns the value of attribute log.



264
265
266
# File 'lib/ncs_navigator/warehouse/transformers/enum_transformer.rb', line 264

def log
  @log
end

Instance Method Details

#verify_or_report_errors(record, status) ⇒ Object



271
272
273
274
275
276
277
278
279
280
# File 'lib/ncs_navigator/warehouse/transformers/enum_transformer.rb', line 271

def verify_or_report_errors(record, status)
  log.debug "Verifying FKs for #{record_ident record}"
  fk_index.verify_or_defer(record).tap do |result|
    if result
      log.debug "- All FKs currently resolved."
    else
      log.debug "- Deferring because one or more FKs are not resolved."
    end
  end
end