Class: Ea::Validation::XmiParity::Counts
- Inherits:
-
Struct
- Object
- Struct
- Ea::Validation::XmiParity::Counts
- Defined in:
- lib/ea/validation/xmi_parity.rb
Overview
Per-element counts for one XMI document.
Instance Attribute Summary collapse
-
#by_type ⇒ Object
Returns the value of attribute by_type.
-
#total ⇒ Object
Returns the value of attribute total.
Instance Method Summary collapse
- #delta(other) ⇒ Object
-
#initialize ⇒ Counts
constructor
A new instance of Counts.
Constructor Details
#initialize ⇒ Counts
Returns a new instance of Counts.
33 34 35 36 |
# File 'lib/ea/validation/xmi_parity.rb', line 33 def initialize(*) super self.by_type ||= {} end |
Instance Attribute Details
#by_type ⇒ Object
Returns the value of attribute by_type
32 33 34 |
# File 'lib/ea/validation/xmi_parity.rb', line 32 def by_type @by_type end |
#total ⇒ Object
Returns the value of attribute total
32 33 34 |
# File 'lib/ea/validation/xmi_parity.rb', line 32 def total @total end |
Instance Method Details
#delta(other) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/ea/validation/xmi_parity.rb', line 38 def delta(other) result = { total: total - other.total } ELEMENT_TYPES.each do |t| result[t] = (by_type[t] || 0) - (other.by_type[t] || 0) end result end |