Class: Shades::Event

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata, dimensions, measures) ⇒ Event

Returns a new instance of Event.



35
36
37
38
39
40
# File 'lib/shades/model.rb', line 35

def initialize(, dimensions, measures)
  @metadata = 
  @dvalues = dimensions
  @mvalues = measures
  @key = @dvalues.keys.map{ |k| k + "=" + @dvalues.fetch(k) }.join(";")
end

Instance Attribute Details

#metadataObject

Returns the value of attribute metadata.



33
34
35
# File 'lib/shades/model.rb', line 33

def 
  @metadata
end

Instance Method Details

#dimension(d) ⇒ Object



46
47
48
# File 'lib/shades/model.rb', line 46

def dimension(d)
  @dvalues[d]
end

#dimensionsObject



54
55
56
# File 'lib/shades/model.rb', line 54

def dimensions
  @metadata.dimensions
end

#keyObject



42
43
44
# File 'lib/shades/model.rb', line 42

def key
  @key
end

#lineObject



62
63
64
65
66
67
68
# File 'lib/shades/model.rb', line 62

def line
  f = []
  f << @metadata.dimensions.map { |k| '%s' % dimension(k) }
  f << @metadata.measures.map   { |k| '%.5f' % measure(k) }
  puts f.inspect
  f.join("\t") 
end

#measure(m) ⇒ Object



50
51
52
# File 'lib/shades/model.rb', line 50

def measure(m)
  @mvalues[m]
end

#measuresObject



58
59
60
# File 'lib/shades/model.rb', line 58

def measures
  @metadata.measures
end