Class: ActiveWarehouse::DimensionView

Inherits:
Dimension
  • Object
show all
Defined in:
lib/active_warehouse/dimension/dimension_view.rb

Overview

DimensionViews represent role-playing dimensions in a data warehouse. These types of dimensions provide a view for an existing dimension. A common use is to provide a date dimension and then provide numerous role-playing dimensions implemented as views to the date dimension, such as Order Date Dimension, Shipping Date Dimension, etc.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Dimension

available_child_values, available_values, available_values_tree, class_for_name, class_name, denominator_count, #expire_value_tree_cache, expire_value_tree_cache, foreign_key, hierarchies, hierarchy, hierarchy_levels, last_modified, set_level_order, sym, table_name, to_dimension

Methods included from SlowlyChangingDimension

included

Methods included from HierarchicalDimension

included

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/active_warehouse/dimension/dimension_view.rb', line 15

def method_missing(method_name, *args)
  unless method_name.to_s =~ /^#{self.class.sym}_/
    method_name = "#{self.class.sym}_#{method_name}".to_sym
  end
  if attribute_present?(method_name)
    read_attribute(method_name)
  else
    raise NameError, "Attribute #{method_name} not found in #{self.class}"
  end
end

Class Method Details

.define_hierarchy(name, hierarchy) ⇒ Object



11
12
13
# File 'lib/active_warehouse/dimension/dimension_view.rb', line 11

def define_hierarchy(name, hierarchy)
  super(name, hierarchy.collect { |name| "#{self.sym}_#{name}".to_sym })
end

.set_order(name) ⇒ Object



8
9
10
# File 'lib/active_warehouse/dimension/dimension_view.rb', line 8

def set_order(name)
  super("#{self.sym}_#{name}".to_sym)
end