Class: XMLA::Cube
- Inherits:
-
Object
- Object
- XMLA::Cube
- Defined in:
- lib/cube/cube.rb
Instance Attribute Summary collapse
-
#catalog ⇒ Object
readonly
Returns the value of attribute catalog.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Class Method Summary collapse
- .execute(query, catalog = XMLA.catalog) ⇒ Object
- .execute_members(query, catalog = XMLA.catalog) ⇒ Object
- .execute_scalar(query, catalog = XMLA.catalog) ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#catalog ⇒ Object (readonly)
Returns the value of attribute catalog.
15 16 17 |
# File 'lib/cube/cube.rb', line 15 def catalog @catalog end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
15 16 17 |
# File 'lib/cube/cube.rb', line 15 def query @query end |
Class Method Details
.execute(query, catalog = XMLA.catalog) ⇒ Object
17 18 19 |
# File 'lib/cube/cube.rb', line 17 def Cube.execute(query, catalog = XMLA.catalog) OlapResult.new(Cube.new(query, catalog).as_table) end |
Instance Method Details
#as_table ⇒ Object
29 30 31 32 |
# File 'lib/cube/cube.rb', line 29 def as_table return [table] if y_size == 0 clean_table(table, y_size).reduce([]) { |result, row| result << row.flatten } end |
#axes ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cube/cube.rb', line 34 def axes axes = all_axes.select { |axe| axe[:@name] != "SlicerAxis" } @axes ||= axes.reduce([]) do |result, axe| result << tuple(axe).reduce([]) { |y, member| data = (member[0] == :member) ? member[1] : member[:member] if ( data.class == Hash || data.size == 1 ) # y << [data[:caption].strip].flatten y << [data].flatten else y << data.select { |item_data| item_data.class == Hash }.reduce([]) do |z,item_data| z << item_data # z << item_data[:caption].strip end end } end end |