Class: Emfsvg::Compat::Result
- Inherits:
-
Struct
- Object
- Struct
- Emfsvg::Compat::Result
- Defined in:
- lib/emfsvg/compat.rb
Overview
Per-fixture comparison result.
Instance Attribute Summary collapse
-
#emfsvg_bytes ⇒ Object
Returns the value of attribute emfsvg_bytes.
-
#emfsvg_elements ⇒ Object
Returns the value of attribute emfsvg_elements.
-
#fixture ⇒ Object
Returns the value of attribute fixture.
-
#ref_bytes ⇒ Object
Returns the value of attribute ref_bytes.
-
#ref_elements ⇒ Object
Returns the value of attribute ref_elements.
Instance Method Summary collapse
Instance Attribute Details
#emfsvg_bytes ⇒ Object
Returns the value of attribute emfsvg_bytes
77 78 79 |
# File 'lib/emfsvg/compat.rb', line 77 def emfsvg_bytes @emfsvg_bytes end |
#emfsvg_elements ⇒ Object
Returns the value of attribute emfsvg_elements
77 78 79 |
# File 'lib/emfsvg/compat.rb', line 77 def emfsvg_elements @emfsvg_elements end |
#fixture ⇒ Object
Returns the value of attribute fixture
77 78 79 |
# File 'lib/emfsvg/compat.rb', line 77 def fixture @fixture end |
#ref_bytes ⇒ Object
Returns the value of attribute ref_bytes
77 78 79 |
# File 'lib/emfsvg/compat.rb', line 77 def ref_bytes @ref_bytes end |
#ref_elements ⇒ Object
Returns the value of attribute ref_elements
77 78 79 |
# File 'lib/emfsvg/compat.rb', line 77 def ref_elements @ref_elements end |
Instance Method Details
#byte_ratio ⇒ Object
79 80 81 |
# File 'lib/emfsvg/compat.rb', line 79 def byte_ratio ref_bytes.zero? ? 0.0 : (emfsvg_bytes.to_f / ref_bytes * 100).round(1) end |
#element_overlap ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/emfsvg/compat.rb', line 83 def element_overlap return 0.0 if emfsvg_elements.empty? shared = emfsvg_elements.keys & ref_elements.keys shared.sum { |k| [emfsvg_elements[k], ref_elements[k]].min }.to_f / emfsvg_elements.values.sum end |
#to_s ⇒ Object
91 92 93 94 |
# File 'lib/emfsvg/compat.rb', line 91 def to_s format("%-40s ref=%8d out=%7d (%5.1f%%) elements_overlap=%.1f", fixture, ref_bytes, emfsvg_bytes, byte_ratio, element_overlap * 100) end |