Class: Cubicle::Data::Hierarchy

Inherits:
Level show all
Includes:
Member
Defined in:
lib/cubicle/data/hierarchy.rb

Instance Attribute Summary collapse

Attributes included from Member

#member_name, #parent_level

Attributes inherited from Level

#dimension, #missing_member_default, #parent_level

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Member

#aggregate_children, #leaf_member?, #measure_data, #measure_values

Methods inherited from Level

#[]=, #flatten, #hierarchy, #leaf_level?, #name

Methods inherited from OrderedHashWithIndifferentAccess

#[], #[]=, #include?, #method_missing

Constructor Details

#initialize(root_dimension, measures) ⇒ Hierarchy

Returns a new instance of Hierarchy.



7
8
9
10
11
# File 'lib/cubicle/data/hierarchy.rb', line 7

def initialize(root_dimension,measures)
  super(root_dimension)
  @measures = measures
  @member_name = name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OrderedHashWithIndifferentAccess

Instance Attribute Details

#measuresObject (readonly)

Returns the value of attribute measures.



6
7
8
# File 'lib/cubicle/data/hierarchy.rb', line 6

def measures
  @measures
end

Class Method Details

.hierarchize_table(table, dimension_names = nil) ⇒ Object



13
14
15
16
# File 'lib/cubicle/data/hierarchy.rb', line 13

def self.hierarchize_table(table, dimension_names=nil)
  dimension_names = [table.time_dimension_name || table.dimension_names].flatten if dimension_names.blank?
  Cubicle::Data::Hierarchy.extract_dimensions(dimension_names,table,table.dup)
end