Class: Cubicle::Measure
Direct Known Subclasses
Instance Attribute Summary collapse
-
#aggregation_method ⇒ Object
can be :sum, :average, :count.
Attributes inherited from Member
#alias_list, #expression, #expression_type, #name, #options
Instance Method Summary collapse
- #default_aggregation_method ⇒ Object
-
#initialize(*args) ⇒ Measure
constructor
A new instance of Measure.
- #to_js_value ⇒ Object
Methods inherited from Member
#included_in?, #matches, #to_js_keys
Constructor Details
#initialize(*args) ⇒ Measure
Returns a new instance of Measure.
4 5 6 7 |
# File 'lib/cubicle/measure.rb', line 4 def initialize(*args) super @aggregation_method = self..delete(:aggregation_method) || default_aggregation_method end |
Instance Attribute Details
#aggregation_method ⇒ Object
can be :sum, :average, :count
9 10 11 |
# File 'lib/cubicle/measure.rb', line 9 def aggregation_method @aggregation_method end |
Instance Method Details
#default_aggregation_method ⇒ Object
16 17 18 |
# File 'lib/cubicle/measure.rb', line 16 def default_aggregation_method :count end |
#to_js_value ⇒ Object
11 12 13 14 |
# File 'lib/cubicle/measure.rb', line 11 def to_js_value return super unless aggregation_method == :count "((#{super}) ? 1 : 0)" end |