Class: Wonkavision::Analytics::CellSet::Cell
- Inherits:
-
Object
- Object
- Wonkavision::Analytics::CellSet::Cell
- Defined in:
- lib/wonkavision/plugins/analytics/cellset.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#measures ⇒ Object
readonly
Returns the value of attribute measures.
Instance Method Summary collapse
- #aggregate(measure_data) ⇒ Object
-
#initialize(key, measure_data) ⇒ Cell
constructor
A new instance of Cell.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(key, measure_data) ⇒ Cell
Returns a new instance of Cell.
123 124 125 126 127 128 129 |
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 123 def initialize(key,measure_data) @key = key @measures = HashWithIndifferentAccess.new measure_data.each_pair do |measure_name,measure| @measures[measure_name] = Measure.new(measure_name,measure) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
137 138 139 |
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 137 def method_missing(method,*args) measures[method] || super end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
121 122 123 |
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 121 def key @key end |
#measures ⇒ Object (readonly)
Returns the value of attribute measures.
122 123 124 |
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 122 def measures @measures end |
Instance Method Details
#aggregate(measure_data) ⇒ Object
130 131 132 133 134 135 136 |
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 130 def aggregate(measure_data) measure_data.each_pair do |measure_name,measure_data| measure = @measures[measure_name] measure ? measure.aggregate(measure_data) : @measures[measure_name] = Measure.new(measure_name,measure) end end |