Class: Vangrail::Triage

Inherits:
Struct
  • Object
show all
Defined in:
lib/vangrail/assessor.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



223
224
225
# File 'lib/vangrail/assessor.rb', line 223

def judged
  @judged
end

Instance Method Details

#certain?Boolean

Returns:

  • (Boolean)


236
237
238
# File 'lib/vangrail/assessor.rb', line 236

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

#droppedObject



224
225
226
# File 'lib/vangrail/assessor.rb', line 224

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

#keptObject



232
233
234
# File 'lib/vangrail/assessor.rb', line 232

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

#reviewObject



228
229
230
# File 'lib/vangrail/assessor.rb', line 228

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

#to_hObject



240
241
242
243
244
245
246
247
# File 'lib/vangrail/assessor.rb', line 240

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