Module: ActiveWarehouse::Report::AbstractReport
- Included in:
- ChartReport, TableReport
- Defined in:
- lib/active_warehouse/report/abstract_report.rb
Overview
Base module for reports.
Instance Attribute Summary collapse
-
#column_filters ⇒ Object
A Hash of level names mapped to a method that is used to filter the available column values.
-
#conditions ⇒ Object
An optional conditions String.
-
#pass_params ⇒ Object
Array of parameters which will be passed.
-
#row_filters ⇒ Object
A Hash of level names mapped to a method that is used to filter the available row values.
Instance Method Summary collapse
-
#column_dimension_class ⇒ Object
Get the column dimension class.
-
#column_hierarchy ⇒ Object
Get the column hierarchy.
-
#column_param_prefix ⇒ Object
Get the column prefix.
-
#cube ⇒ Object
Get the current cube instance.
-
#cube_name=(name) ⇒ Object
Set the cube name.
-
#fact_attributes ⇒ Object
Get the list of displayed fact attributes.
-
#fact_class ⇒ Object
Get the fact class.
-
#row_dimension_class ⇒ Object
Get the row dimension class.
-
#row_hierarchy ⇒ Object
Get the row hierarchy.
-
#row_param_prefix ⇒ Object
Get the row parameter prefix.
Instance Attribute Details
#column_filters ⇒ Object
A Hash of level names mapped to a method that is used to filter the available column values
11 12 13 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 11 def column_filters @column_filters end |
#conditions ⇒ Object
An optional conditions String
18 19 20 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 18 def conditions @conditions end |
#pass_params ⇒ Object
Array of parameters which will be passed
7 8 9 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 7 def pass_params @pass_params end |
#row_filters ⇒ Object
A Hash of level names mapped to a method that is used to filter the available row values
15 16 17 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 15 def row_filters @row_filters end |
Instance Method Details
#column_dimension_class ⇒ Object
Get the column dimension class
41 42 43 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 41 def column_dimension_class @column_dimension_class ||= ActiveWarehouse::Dimension.class_name(self.column_dimension_name).constantize end |
#column_hierarchy ⇒ Object
Get the column hierarchy. Uses the first hierarchy in the column dimension if not specified
46 47 48 49 50 51 52 53 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 46 def column_hierarchy ch = read_attribute(:column_hierarchy) if ch.nil? || ch == 'NULL' column_dimension_class.hierarchies.first else ch end end |
#column_param_prefix ⇒ Object
Get the column prefix. Returns ‘c’ if not specified.
56 57 58 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 56 def column_param_prefix read_attribute(:column_param_prefix) || 'c' end |
#cube ⇒ Object
Get the current cube instance
27 28 29 30 31 32 33 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 27 def cube if @cube.nil? cube_class = ActiveWarehouse::Cube.class_name(self.cube_name).constantize @cube = cube_class.new end @cube end |
#cube_name=(name) ⇒ Object
Set the cube name
21 22 23 24 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 21 def cube_name=(name) write_attribute(:cube_name, name) @cube = nil end |
#fact_attributes ⇒ Object
Get the list of displayed fact attributes. If this value is not specified then all aggregate and calculated fields will be displayed
77 78 79 80 81 82 83 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 77 def fact_attributes return read_attribute(:fact_attributes) if read_attribute(:fact_attributes) fa = [] fact_class.aggregate_fields.each { |field| fa << field } fact_class.calculated_fields.each { |field| fa << field } fa end |
#fact_class ⇒ Object
Get the fact class
36 37 38 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 36 def fact_class cube.class.fact_class end |
#row_dimension_class ⇒ Object
Get the row dimension class
61 62 63 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 61 def row_dimension_class @row_dimension_class ||= ActiveWarehouse::Dimension.class_name(self.row_dimension_name).constantize end |
#row_hierarchy ⇒ Object
Get the row hierarchy. Uses the first hierarchy in the row dimension if not specified
66 67 68 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 66 def row_hierarchy read_attribute(:row_hierarchy) || row_dimension_class.hierarchies.first end |
#row_param_prefix ⇒ Object
Get the row parameter prefix. Returns ‘r’ if not specified.
71 72 73 |
# File 'lib/active_warehouse/report/abstract_report.rb', line 71 def row_param_prefix read_attribute(:row_param_prefix) || 'r' end |