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.



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

def initialize(per_diagram:)
  @per_diagram = per_diagram
end

Instance Attribute Details

#per_diagramObject (readonly)

Returns the value of attribute per_diagram.



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

def per_diagram
  @per_diagram
end

Instance Method Details

#aggregate_shape_countsObject



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

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



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

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

#outliers(shape_tolerance: 5) ⇒ Object



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

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

#text_overlap_avgObject



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

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



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

def total
  per_diagram.size
end