Class: Wongi::Engine::DSL::Clause::Aggregate
- Inherits:
-
Object
- Object
- Wongi::Engine::DSL::Clause::Aggregate
- Defined in:
- lib/wongi-engine/dsl/clause/aggregate.rb
Instance Attribute Summary collapse
-
#aggregate ⇒ Object
readonly
Returns the value of attribute aggregate.
-
#map ⇒ Object
readonly
Returns the value of attribute map.
-
#over ⇒ Object
readonly
Returns the value of attribute over.
-
#partition ⇒ Object
readonly
Returns the value of attribute partition.
-
#var ⇒ Object
readonly
Returns the value of attribute var.
Instance Method Summary collapse
- #compile(context) ⇒ Object
-
#initialize(var, options = {}) ⇒ Aggregate
constructor
A new instance of Aggregate.
Constructor Details
#initialize(var, options = {}) ⇒ Aggregate
Returns a new instance of Aggregate.
6 7 8 9 10 11 12 13 |
# File 'lib/wongi-engine/dsl/clause/aggregate.rb', line 6 def initialize(var, = {}) @var = var @over = [:over] @partition = Array([:partition]) @aggregate = [:using] @map = [:map] raise "can only partition by variables" unless partition.all? { |p| Template.variable?(p) } end |
Instance Attribute Details
#aggregate ⇒ Object (readonly)
Returns the value of attribute aggregate.
4 5 6 |
# File 'lib/wongi-engine/dsl/clause/aggregate.rb', line 4 def aggregate @aggregate end |
#map ⇒ Object (readonly)
Returns the value of attribute map.
4 5 6 |
# File 'lib/wongi-engine/dsl/clause/aggregate.rb', line 4 def map @map end |
#over ⇒ Object (readonly)
Returns the value of attribute over.
4 5 6 |
# File 'lib/wongi-engine/dsl/clause/aggregate.rb', line 4 def over @over end |
#partition ⇒ Object (readonly)
Returns the value of attribute partition.
4 5 6 |
# File 'lib/wongi-engine/dsl/clause/aggregate.rb', line 4 def partition @partition end |
#var ⇒ Object (readonly)
Returns the value of attribute var.
4 5 6 |
# File 'lib/wongi-engine/dsl/clause/aggregate.rb', line 4 def var @var end |
Instance Method Details
#compile(context) ⇒ Object
15 16 17 |
# File 'lib/wongi-engine/dsl/clause/aggregate.rb', line 15 def compile(context) context.tap { |c| c.aggregate_node(var, over, partition, aggregate, map) } end |