class MDQuery::DSL::DimensionDSL
DSL
for describing a Dimension consisting of an ordered list of segments
Public Class Methods
new(key, &proc)
click to toggle source
# File lib/mdquery/dsl.rb, line 98 def initialize(key, &proc) raise "no block!" if !proc @key = key @segments = [] self.instance_eval(&proc) end
Public Instance Methods
label(l)
click to toggle source
set the Label for the segment
-
label
a label for the segment
# File lib/mdquery/dsl.rb, line 92 def label(l) @label = l end
segment(key, &proc)
click to toggle source
define a segment
-
key
the segment key, should be unique in the Dimension -
proc
theDimensionSegmentDSL
Proc
# File lib/mdquery/dsl.rb, line 85 def segment(key, &proc) raise "no block!" if !proc @segments << DimensionSegmentDSL.new(key, &proc) end
Private Instance Methods
build()
click to toggle source
# File lib/mdquery/dsl.rb, line 105 def build dd = MDQuery::Model::DimensionModel.new(:key=>@key, :label=>@label) ss = @segments.map{|dsdsl| dsdsl.send(:build, dd)} dd.instance_eval{@segment_models = ss} dd.validate dd end