Class: AfterTheDeadline::Metrics

Inherits:
Object
  • Object
show all
Defined in:
lib/merimee/after_the_deadline.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(array) ⇒ Metrics

Returns a new instance of Metrics.



85
86
87
88
89
90
91
92
93
94
# File 'lib/merimee/after_the_deadline.rb', line 85

def initialize(array)
  unless array.kind_of?(Array) && array.all? {|i| i.kind_of?(Hash) }
    raise "#{self.class} must be initialized with an Array of Hashes"
  end

  self.spell, self.grammer, self.stats, self.style = {}, {}, {}, {}
  array.each do |metric|
    self.send(metric['type'])[metric['key']] = metric['value']
  end
end

Instance Attribute Details

#grammerObject

Returns the value of attribute grammer.



83
84
85
# File 'lib/merimee/after_the_deadline.rb', line 83

def grammer
  @grammer
end

#spellObject

Returns the value of attribute spell.



83
84
85
# File 'lib/merimee/after_the_deadline.rb', line 83

def spell
  @spell
end

#statsObject

Returns the value of attribute stats.



83
84
85
# File 'lib/merimee/after_the_deadline.rb', line 83

def stats
  @stats
end

#styleObject

Returns the value of attribute style.



83
84
85
# File 'lib/merimee/after_the_deadline.rb', line 83

def style
  @style
end