Class: Canopus::DisplayMap::Summary
- Inherits:
-
Struct
- Object
- Struct
- Canopus::DisplayMap::Summary
- Defined in:
- lib/canopus/display_map/summary.rb
Constant Summary collapse
- ZERO =
new(0, 0, 0)
Instance Attribute Summary collapse
-
#display_rows ⇒ Object
Returns the value of attribute display_rows.
-
#pending_rows ⇒ Object
Returns the value of attribute pending_rows.
-
#source_rows ⇒ Object
Returns the value of attribute source_rows.
Class Method Summary collapse
Instance Method Summary collapse
- #+(other) ⇒ Object
-
#initialize(source_rows, display_rows, pending_rows) ⇒ Summary
constructor
A new instance of Summary.
- #project_combined(dimension, other) ⇒ Object
Constructor Details
#initialize(source_rows, display_rows, pending_rows) ⇒ Summary
Returns a new instance of Summary.
4 5 6 7 |
# File 'lib/canopus/display_map/summary.rb', line 4 def initialize(source_rows, display_rows, pending_rows) super freeze end |
Instance Attribute Details
#display_rows ⇒ Object
Returns the value of attribute display_rows
3 4 5 |
# File 'lib/canopus/display_map/summary.rb', line 3 def display_rows @display_rows end |
#pending_rows ⇒ Object
Returns the value of attribute pending_rows
3 4 5 |
# File 'lib/canopus/display_map/summary.rb', line 3 def pending_rows @pending_rows end |
#source_rows ⇒ Object
Returns the value of attribute source_rows
3 4 5 |
# File 'lib/canopus/display_map/summary.rb', line 3 def source_rows @source_rows end |
Class Method Details
.zero ⇒ Object
9 |
# File 'lib/canopus/display_map/summary.rb', line 9 def self.zero = ZERO |
Instance Method Details
#+(other) ⇒ Object
10 11 12 13 14 |
# File 'lib/canopus/display_map/summary.rb', line 10 def +(other) return other if source_rows.zero? return self if other.source_rows.zero? Canopus::DisplayMap::Summary.new(source_rows + other.source_rows, display_rows + other.display_rows, pending_rows + other.pending_rows) end |
#project_combined(dimension, other) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/canopus/display_map/summary.rb', line 15 def project_combined(dimension, other) case dimension when :source_rows then source_rows + other.source_rows when :display_rows then display_rows + other.display_rows when :pending_rows then pending_rows + other.pending_rows else raise ArgumentError, "unknown display summary dimension: #{dimension}" end end |