Class: AfterTheDeadline::Metrics

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(array) ⇒ Metrics

Returns a new instance of Metrics.



121
122
123
124
125
126
127
128
129
130
# File 'lib/after_the_deadline.rb', line 121

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.grammar, self.stats, self.style = {}, {}, {}, {}
  array.each do |metric|
    self.send(metric['type'])[metric['key']] = metric['value']
  end
end

Instance Attribute Details

#grammarObject

Returns the value of attribute grammar.



119
120
121
# File 'lib/after_the_deadline.rb', line 119

def grammar
  @grammar
end

#spellObject

Returns the value of attribute spell.



119
120
121
# File 'lib/after_the_deadline.rb', line 119

def spell
  @spell
end

#statsObject

Returns the value of attribute stats.



119
120
121
# File 'lib/after_the_deadline.rb', line 119

def stats
  @stats
end

#styleObject

Returns the value of attribute style.



119
120
121
# File 'lib/after_the_deadline.rb', line 119

def style
  @style
end