Method: Webhookdb::Replicator::Base#_find_dependency_candidate

Defined in:
lib/webhookdb/replicator/base.rb

#_find_dependency_candidate(value) ⇒ Object

Parameters:

  • value (String)

Raises:



228
229
230
231
232
233
234
235
236
# File 'lib/webhookdb/replicator/base.rb', line 228

def _find_dependency_candidate(value)
  int_val = value.strip.blank? ? 1 : value.to_i
  idx = int_val - 1
  dep_candidates = self.service_integration.dependency_candidates
  raise Webhookdb::InvalidPrecondition, "no dependency candidates" if dep_candidates.empty?
  raise Webhookdb::InvalidInput, "'#{value}' is not a valid dependency" if
    idx.negative? || idx >= dep_candidates.length
  return dep_candidates[idx]
end