Class: MDQuery::Dataset::DimensionValue

Inherits:
Object
  • Object
show all
Defined in:
lib/mdquery/dataset.rb

Overview

describes a value on a segment of a dimension

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dimension_segment, value, label) ⇒ DimensionValue

Returns a new instance of DimensionValue.



17
18
19
20
21
22
# File 'lib/mdquery/dataset.rb', line 17

def initialize(dimension_segment, value, label)
  @dimension_segment = dimension_segment
  @value = value
  @label = label
  validate
end

Instance Attribute Details

#dimension_segmentObject (readonly)

DimensionSegment this value belongs to



9
10
11
# File 'lib/mdquery/dataset.rb', line 9

def dimension_segment
  @dimension_segment
end

#labelObject (readonly)

Optional label for the value



15
16
17
# File 'lib/mdquery/dataset.rb', line 15

def label
  @label
end

#valueObject (readonly)

the value



12
13
14
# File 'lib/mdquery/dataset.rb', line 12

def value
  @value
end

Instance Method Details

#inspectObject



29
30
31
# File 'lib/mdquery/dataset.rb', line 29

def inspect
  "#<DimensionValue: value=#{value.inspect}, label=#{label.inspect}>"
end

#validateObject



24
25
26
27
# File 'lib/mdquery/dataset.rb', line 24

def validate
  raise "no dimension_segment!" if !dimension_segment
  raise "no value!" if !value
end