Class: Mondrian::OLAP::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/mondrian_rest/mondrian_ext.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cubeObject

Returns the value of attribute cube.



133
134
135
# File 'lib/mondrian_rest/mondrian_ext.rb', line 133

def cube
  @cube
end

#mdxObject

Returns the value of attribute mdx.



133
134
135
# File 'lib/mondrian_rest/mondrian_ext.rb', line 133

def mdx
  @mdx
end

#propertiesObject

Returns the value of attribute properties.



133
134
135
# File 'lib/mondrian_rest/mondrian_ext.rb', line 133

def properties
  @properties
end

Instance Method Details

#to_h(parents = false, debug = false) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/mondrian_rest/mondrian_ext.rb', line 139

def to_h(parents=false, debug=false)
  # XXX TODO
  # return the contents of the filter axis
  # puts self.raw_cell_set.getFilterAxis.inspect

  dimensions = self.axis_members.map { |am| am.first.dimension_info }

  pprops = unless self.properties.nil?
             parse_properties(dimensions[1..-1]) # exclude Measures dimension
           else
             {}
           end

  rv = {
    axes: self.axis_members.each_with_index.map { |a, i|
      {
        members: a.map { |m|
          mh = m.to_h(pprops[m.raw_member.getDimension.name] || [])
          if parents
            mh.merge!({
                        ancestors: m.ancestors.map { |ma|
                          ma.to_h(pprops[ma.raw_member.getDimension.name] || [])
                        }
                      })
          end
          mh
        }
      }
    },
    axis_dimensions: dimensions,
    values: self.values
  }

  rv[:mdx] = self.mdx if debug

  rv

end

#to_jsonObject



135
136
137
# File 'lib/mondrian_rest/mondrian_ext.rb', line 135

def to_json
  to_h.to_json
end