Class: Shades::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/shades/cube.rb

Instance Method Summary collapse

Constructor Details

#initialize(dcs) ⇒ Processor

Returns a new instance of Processor.



91
92
93
# File 'lib/shades/cube.rb', line 91

def initialize(dcs)
  @dcs = dcs
end

Instance Method Details

#send(event) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/shades/cube.rb', line 95

def send(event)
  # optionally filter stuff out here by some kind of predicate in the future
  ###
  # remap inbound to outbound dimensions
  d = {}
  dlist = []
  @dcs.each do |dc|
    dlist.push(dc.outbound_dimension)
    d[dc.outbound_dimension] = dc.get_value(event)
  end
  m = {}
  mlist = []
  event.measures.each do |k|
    mlist.push(k)
    m[k] = event.measure(k)
  end
  Event.new(Metadata.new(dlist, mlist), d, m)
end