Class: DtraceAggregate
- Inherits:
-
Object
- Object
- DtraceAggregate
- Defined in:
- lib/dtraceaggregate.rb
Overview
Represents an aggregation record built from a series of DtraceAggData records.
Intended to to built up by calling add_record repeatedly with DtraceAggData objects until a completed DtraceAggregate is returned. (until a complete record is available, add_record returns nil).
See dtraceconsumer.rb for an example of this.
Instance Attribute Summary collapse
-
#tuple ⇒ Object
readonly
Returns the value of attribute tuple.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#add_record(r) ⇒ Object
Add a DtraceAggData record to this aggregate.
-
#initialize ⇒ DtraceAggregate
constructor
Create an empty DtraceAggregate: use
add_recordto add data.
Constructor Details
#initialize ⇒ DtraceAggregate
Create an empty DtraceAggregate: use add_record to add data.
18 19 20 |
# File 'lib/dtraceaggregate.rb', line 18 def initialize @tuple = Array.new end |
Instance Attribute Details
#tuple ⇒ Object (readonly)
Returns the value of attribute tuple.
15 16 17 |
# File 'lib/dtraceaggregate.rb', line 15 def tuple @tuple end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
15 16 17 |
# File 'lib/dtraceaggregate.rb', line 15 def value @value end |
Instance Method Details
#add_record(r) ⇒ Object
Add a DtraceAggData record to this aggregate. Returns nil until it receives a record of aggtype “last”, when it returns the complete DtraceAggregate.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dtraceaggregate.rb', line 25 def add_record(r) case r.aggtype when "tuple" @tuple << r.value when "value" @value = r.value when "last" return self end nil end |