Class: Vangrail::Engine::Screening

Inherits:
Struct
  • Object
show all
Defined in:
lib/vangrail/engine.rb

Overview

What screen returns. certain means what it means on a Result: false says a rail did not reach a decision about some document, so "nothing was rejected" is not evidence that nothing was wrong.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#certainObject

Returns the value of attribute certain

Returns:

  • (Object)

    the current value of certain



80
81
82
# File 'lib/vangrail/engine.rb', line 80

def certain
  @certain
end

#keptObject

Returns the value of attribute kept

Returns:

  • (Object)

    the current value of kept



80
81
82
# File 'lib/vangrail/engine.rb', line 80

def kept
  @kept
end

#reasonObject

Returns the value of attribute reason

Returns:

  • (Object)

    the current value of reason



80
81
82
# File 'lib/vangrail/engine.rb', line 80

def reason
  @reason
end

#rejectedObject

Returns the value of attribute rejected

Returns:

  • (Object)

    the current value of rejected



80
81
82
# File 'lib/vangrail/engine.rb', line 80

def rejected
  @rejected
end

Instance Method Details

#cellsObject



89
90
91
# File 'lib/vangrail/engine.rb', line 89

def cells
  kept.map { |document| Cell.data(Cell.text_of(document)) }
end

#certain?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/vangrail/engine.rb', line 81

def certain?
  certain
end

#rejected?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/vangrail/engine.rb', line 85

def rejected?
  !rejected.empty?
end

#to_hObject



93
94
95
96
97
98
99
100
# File 'lib/vangrail/engine.rb', line 93

def to_h
  {
    'kept' => kept.size,
    'rejected' => rejected.map { |r| r[:result].to_h },
    'certain' => certain?,
    'reason' => reason,
  }.compact
end