Class: Memory::Aggregate::Total
- Inherits:
-
Struct
- Object
- Struct
- Memory::Aggregate::Total
- Defined in:
- lib/memory/aggregate.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#memory ⇒ Object
Returns the value of attribute memory.
Instance Method Summary collapse
- #<<(allocation) ⇒ Object
- #formatted_memory ⇒ Object
-
#initialize ⇒ Total
constructor
A new instance of Total.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Total
Returns a new instance of Total.
46 47 48 |
# File 'lib/memory/aggregate.rb', line 46 def initialize super(0, 0) end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count
45 46 47 |
# File 'lib/memory/aggregate.rb', line 45 def count @count end |
#memory ⇒ Object
Returns the value of attribute memory
45 46 47 |
# File 'lib/memory/aggregate.rb', line 45 def memory @memory end |
Instance Method Details
#<<(allocation) ⇒ Object
50 51 52 53 |
# File 'lib/memory/aggregate.rb', line 50 def << allocation self.memory += allocation.size self.count += 1 end |
#formatted_memory ⇒ Object
55 56 57 |
# File 'lib/memory/aggregate.rb', line 55 def formatted_memory self.memory end |
#to_s ⇒ Object
59 60 61 |
# File 'lib/memory/aggregate.rb', line 59 def to_s "(#{Memory.formatted_bytes memory} in #{count} allocations)" end |