Class: CurrentScope::SodPreflight::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/current_scope/sod_preflight.rb

Overview

One scan's answer, carried as a value instead of left on the module.

Every honesty rule this feature has needed — "an empty list is not an all-clear", "a run that skipped checks under-reports", "a run that inspected nothing proves nothing" — is a question about ONE scan. Holding that on a singleton made the answers depend on call order, needed a fail-closed special case for "never run", and made the rake task capture a flag next to the call so 140 lines later it still meant the right run. A value has none of those problems: you cannot ask a result you do not have. (#133 review — cubic, ie-predictability, ie-architecture all landed on this seam.)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#in_scopeObject

Returns the value of attribute in_scope

Returns:

  • (Object)

    the current value of in_scope



46
47
48
# File 'lib/current_scope/sod_preflight.rb', line 46

def in_scope
  @in_scope
end

#inspectedObject

Returns the value of attribute inspected

Returns:

  • (Object)

    the current value of inspected



46
47
48
# File 'lib/current_scope/sod_preflight.rb', line 46

def inspected
  @inspected
end

#rowsObject

Returns the value of attribute rows

Returns:

  • (Object)

    the current value of rows



46
47
48
# File 'lib/current_scope/sod_preflight.rb', line 46

def rows
  @rows
end

#skippedObject

Returns the value of attribute skipped

Returns:

  • (Object)

    the current value of skipped



46
47
48
# File 'lib/current_scope/sod_preflight.rb', line 46

def skipped
  @skipped
end

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


54
# File 'lib/current_scope/sod_preflight.rb', line 54

def any? = rows.any?

#blind?Boolean

The list cannot be read as an all-clear: either a check failed, or there was nothing to read because no controller in scope declared a model.

Returns:

  • (Boolean)


52
# File 'lib/current_scope/sod_preflight.rb', line 52

def blind? = degraded? || (inspected.zero? && in_scope.positive?)

#degraded?Boolean

Some check could not be completed, so the list under-reports.

Returns:

  • (Boolean)


48
# File 'lib/current_scope/sod_preflight.rb', line 48

def degraded? = skipped.any?