Class: Ea::Svg::Parity::Suite::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/svg/parity/suite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(per_diagram:) ⇒ Report

Returns a new instance of Report.



71
72
73
# File 'lib/ea/svg/parity/suite.rb', line 71

def initialize(per_diagram:)
  @per_diagram = per_diagram
end

Instance Attribute Details

#per_diagramObject (readonly)

Returns the value of attribute per_diagram.



69
70
71
# File 'lib/ea/svg/parity/suite.rb', line 69

def per_diagram
  @per_diagram
end

Instance Method Details

#aggregate_shape_countsObject



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/ea/svg/parity/suite.rb', line 83

def aggregate_shape_counts
  ours = { rect: 0, polygon: 0, path: 0, text: 0 }
  ref = { rect: 0, polygon: 0, path: 0, text: 0 }
  per_diagram.each do |dr|
    ours[:rect] += dr.report.rect.ours
    ours[:polygon] += dr.report.polygon.ours
    ours[:path] += dr.report.path.ours
    ours[:text] += dr.report.text.ours
    ref[:rect] += dr.report.rect.reference
    ref[:polygon] += dr.report.polygon.reference
    ref[:path] += dr.report.path.reference
    ref[:text] += dr.report.text.reference
  end
  { ours: ours, reference: ref }
end

#matched(shape_tolerance: 5) ⇒ Object



79
80
81
# File 'lib/ea/svg/parity/suite.rb', line 79

def matched(shape_tolerance: 5)
  per_diagram.count { |dr| dr.report.shape_delta_total <= shape_tolerance }
end

#outliers(shape_tolerance: 5) ⇒ Object



106
107
108
# File 'lib/ea/svg/parity/suite.rb', line 106

def outliers(shape_tolerance: 5)
  per_diagram.select { |dr| dr.report.shape_delta_total > shape_tolerance }
end

#text_overlap_avgObject



99
100
101
102
103
104
# File 'lib/ea/svg/parity/suite.rb', line 99

def text_overlap_avg
  return 0.0 if per_diagram.empty?

  overlaps = per_diagram.map(&:report).map(&:text_overlap)
  overlaps.sum / overlaps.size.to_f
end

#totalObject



75
76
77
# File 'lib/ea/svg/parity/suite.rb', line 75

def total
  per_diagram.size
end