Class: Codeball::ExtractionSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/codeball/extraction_summary.rb

Overview

Aggregates results from extracting multiple entries. Pure data class - no output methods.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results, malformed: 0) ⇒ ExtractionSummary

Returns a new instance of ExtractionSummary.



8
9
10
11
# File 'lib/codeball/extraction_summary.rb', line 8

def initialize(results, malformed: 0)
  @results = results
  @malformed = malformed
end

Instance Attribute Details

#malformedObject (readonly)

Returns the value of attribute malformed.



6
7
8
# File 'lib/codeball/extraction_summary.rb', line 6

def malformed
  @malformed
end

#resultsObject (readonly)

Returns the value of attribute results.



6
7
8
# File 'lib/codeball/extraction_summary.rb', line 6

def results
  @results
end

Instance Method Details

#dry_run?Boolean

Returns:

  • (Boolean)


15
# File 'lib/codeball/extraction_summary.rb', line 15

def dry_run? = results.any? { it.status == :dry_run }

#extractedObject



13
# File 'lib/codeball/extraction_summary.rb', line 13

def extracted = results.count(&:success?)

#skippedObject



14
# File 'lib/codeball/extraction_summary.rb', line 14

def skipped = results.count { !it.success? }