Class: Mondrian::OLAP::Schema

Inherits:
SchemaElement show all
Defined in:
lib/mondrian/olap/schema.rb,
lib/mondrian/olap/schema_udf.rb

Overview

See mondrian.pentaho.com/documentation/schema.php for more detailed description of Mondrian Schema elements.

Defined Under Namespace

Modules: ScriptElements Classes: AggExclude, AggFactCount, AggForeignKey, AggIgnoreColumn, AggLevel, AggMeasure, AggName, AggPattern, Annotation, Annotations, CalculatedMember, CalculatedMemberProperty, CaptionExpression, CellFormatter, Cube, CubeGrant, Dimension, DimensionGrant, DimensionUsage, Formula, Hierarchy, HierarchyGrant, Join, KeyExpression, Level, Measure, MeasureExpression, MemberFormatter, MemberGrant, NameExpression, OrdinalExpression, Parameter, Property, PropertyFormatter, Role, RoleUsage, SchemaGrant, Script, Sql, Table, Union, UserDefinedFunction, View, VirtualCube, VirtualCubeDimension, VirtualCubeMeasure

Instance Attribute Summary

Attributes inherited from SchemaElement

#xml_fragments

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SchemaElement

attributes, content, data_dictionary_names, elements, #to_xml, #xml

Constructor Details

#initialize(name = nil, attributes = {}, parent = nil, &block) ⇒ Schema

Returns a new instance of Schema.



8
9
10
11
12
# File 'lib/mondrian/olap/schema.rb', line 8

def initialize(name = nil, attributes = {}, parent = nil, &block)
  name, attributes = self.class.pre_process_arguments(name, attributes)
  pre_process_attributes(attributes)
  super(name, attributes, parent, &block)
end

Class Method Details

.define(name = nil, attributes = {}, &block) ⇒ Object



14
15
16
17
# File 'lib/mondrian/olap/schema.rb', line 14

def self.define(name = nil, attributes = {}, &block)
  name, attributes = pre_process_arguments(name, attributes)
  new(name || 'default', attributes, &block)
end

Instance Method Details

#define(name = nil, attributes = {}, &block) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/mondrian/olap/schema.rb', line 19

def define(name = nil, attributes = {}, &block)
  name, attributes = self.class.pre_process_arguments(name, attributes)
  pre_process_attributes(attributes)
  @attributes[:name] = name || @attributes[:name] || 'default' # otherwise connection with empty name fails
  instance_eval(&block) if block
  self
end

#include_schema(shared_schema) ⇒ Object



27
28
29
30
31
# File 'lib/mondrian/olap/schema.rb', line 27

def include_schema(shared_schema)
  shared_schema.class.elements.each do |element|
    instance_variable_get("@#{pluralize(element)}").concat shared_schema.send(pluralize(element))
  end
end

#user_defined_cell_formatter(name, &block) ⇒ Object



7
8
9
# File 'lib/mondrian/olap/schema_udf.rb', line 7

def user_defined_cell_formatter(name, &block)
  CellFormatter.new(name, &block)
end