Class: MDQuery::DSL::DatasetDSL
- Inherits:
-
Object
- Object
- MDQuery::DSL::DatasetDSL
- Defined in:
- lib/mdquery/dsl.rb
Overview
DSL for defining a Dataset with a number of Measures over a number of Dimensions where each Dimension consists of a number of Segments
Instance Method Summary collapse
-
#dimension(key, &proc) ⇒ Object
define a Dimension *
key
the key identifying the Dimension in the Dataset *proc
a DimensionDSL Proc. -
#measure(key, definition, cast = nil) ⇒ Object
define a Measure *
key
the key identifying the Measure in the Dataset *definition
the SQL fragment defining the measure *cast
a symbol identifying a case from MDQuery::Model::CASTS. -
#source(scope) ⇒ Object
define the datasource for the Dataset *
scope
an ActiveRecord scope, used as the basis for all region queries.
Instance Method Details
#dimension(key, &proc) ⇒ Object
define a Dimension
-
key
the key identifying the Dimension in the Dataset -
proc
a DimensionDSL Proc
145 146 147 |
# File 'lib/mdquery/dsl.rb', line 145 def dimension(key, &proc) @dimensions << DimensionDSL.new(key, &proc) end |
#measure(key, definition, cast = nil) ⇒ Object
define a Measure
-
key
the key identifying the Measure in the Dataset -
definition
the SQL fragment defining the measure -
cast
a symbol identifying a case from MDQuery::Model::CASTS. Optional
153 154 155 |
# File 'lib/mdquery/dsl.rb', line 153 def measure(key, definition, cast=nil) @measures << MeasureDSL.new(key, definition, cast) end |
#source(scope) ⇒ Object
define the datasource for the Dataset
-
scope
an ActiveRecord scope, used as the basis for all region queries
137 138 139 140 |
# File 'lib/mdquery/dsl.rb', line 137 def source(scope) raise "source already set" if @source @source = scope end |