Class: Vangrail::Engine::Triage

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

Overview

What triage returns. The ranking is the product: a caller that wants the old behaviour reads kept, and one that wants to put the doubtful pages last reads them in order.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#judgedObject

Returns the value of attribute judged

Returns:

  • (Object)

    the current value of judged



185
186
187
# File 'lib/vangrail/engine.rb', line 185

def judged
  @judged
end

Instance Method Details

#certain?Boolean

Returns:

  • (Boolean)


198
199
200
# File 'lib/vangrail/engine.rb', line 198

def certain?
  judged.all? { |row| row[:judgement].certain? }
end

#droppedObject



186
187
188
# File 'lib/vangrail/engine.rb', line 186

def dropped
  judged.select { |row| row[:judgement].block? }
end

#keptObject



194
195
196
# File 'lib/vangrail/engine.rb', line 194

def kept
  judged.reject { |row| row[:judgement].block? }.reverse.map { |row| row[:document] }
end

#reviewObject



190
191
192
# File 'lib/vangrail/engine.rb', line 190

def review
  judged.select { |row| row[:judgement].review? }
end

#to_hObject



202
203
204
205
206
207
208
209
# File 'lib/vangrail/engine.rb', line 202

def to_h
  {
    'kept' => kept.size,
    'review' => review.size,
    'dropped' => dropped.map { |row| row[:judgement].to_h },
    'certain' => certain?,
  }
end