Class: Vangrail::Rails::Missing

Inherits:
Vangrail::Rail show all
Defined in:
lib/vangrail/rails/missing.rb

Overview

Stands in for a rail that was asked for and could not be built.

Without this, a configuration asking for a model-backed rail against an endpoint that is down produces an engine holding only its offline rails. Those rails pass, the engine reports passed and certain, and the answer is a lie: the check the operator configured never ran.

A placeholder that always returns unchecked keeps the arithmetic right. The turn is allowed, the engine's result is uncertain, and the reason names what is missing and why.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason:, name: 'missing', sides: Rail::SIDES) ⇒ Missing

Returns a new instance of Missing.



20
21
22
23
# File 'lib/vangrail/rails/missing.rb', line 20

def initialize(reason:, name: 'missing', sides: Rail::SIDES)
  super(name: name, sides: sides)
  @reason = reason
end

Instance Attribute Details

#reasonObject (readonly)

Returns the value of attribute reason.



18
19
20
# File 'lib/vangrail/rails/missing.rb', line 18

def reason
  @reason
end

Instance Method Details

#call(_text, _context) ⇒ Object



33
34
35
# File 'lib/vangrail/rails/missing.rb', line 33

def call(_text, _context)
  unchecked(reason)
end

#offline?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/vangrail/rails/missing.rb', line 25

def offline?
  true
end

#placeholder?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/vangrail/rails/missing.rb', line 29

def placeholder?
  true
end