Class: Wonkavision::Analytics::CellSet

Inherits:
Object
  • Object
show all
Defined in:
lib/wonkavision/plugins/analytics/cellset.rb

Defined Under Namespace

Classes: Axis, Cell, Dimension, Measure, Member

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aggregation, query, tuples) ⇒ CellSet

Returns a new instance of CellSet.



8
9
10
11
12
13
14
15
16
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 8

def initialize(aggregation,query,tuples)
  @axes = []
  @query = query
  dimension_members, @cells = process_tuples(aggregation, query, tuples)

  query.axes.each do |axis_dimensions|
    @axes << Axis.new(axis_dimensions,dimension_members,aggregation)
  end
end

Instance Attribute Details

#axesObject (readonly)

Returns the value of attribute axes.



6
7
8
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 6

def axes
  @axes
end

#queryObject (readonly)

Returns the value of attribute query.



6
7
8
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 6

def query
  @query
end

Instance Method Details

#[](*coordinates) ⇒ Object



28
29
30
31
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 28

def [](*coordinates)
  key = coordinates.map{ |c|c.to_s }
  @cells[key]
end

#chaptersObject



21
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 21

def chapters; axes[3]; end

#columnsObject



18
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 18

def columns; axes[0]; end

#inspectObject



24
25
26
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 24

def inspect
  "<Cellset #{object_id} select:#{@query.selected_dimensions} where:#{@query.slicer}>"
end

#lengthObject



33
34
35
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 33

def length
  @cells.length
end

#pagesObject



20
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 20

def pages; axex[2]; end

#rowsObject



19
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 19

def rows; axes[1]; end

#sectionsObject



22
# File 'lib/wonkavision/plugins/analytics/cellset.rb', line 22

def sections; axes[4]; end