Class: AfterTheDeadline::Metrics
- Inherits:
-
Object
- Object
- AfterTheDeadline::Metrics
- Defined in:
- lib/after_the_deadline.rb
Instance Attribute Summary collapse
-
#grammar ⇒ Object
readonly
Returns the value of attribute grammar.
-
#spell ⇒ Object
readonly
Returns the value of attribute spell.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Instance Method Summary collapse
-
#initialize(array) ⇒ Metrics
constructor
A new instance of Metrics.
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
#grammar ⇒ Object
Returns the value of attribute grammar.
119 120 121 |
# File 'lib/after_the_deadline.rb', line 119 def grammar @grammar end |
#spell ⇒ Object
Returns the value of attribute spell.
119 120 121 |
# File 'lib/after_the_deadline.rb', line 119 def spell @spell end |
#stats ⇒ Object
Returns the value of attribute stats.
119 120 121 |
# File 'lib/after_the_deadline.rb', line 119 def stats @stats end |
#style ⇒ Object
Returns the value of attribute style.
119 120 121 |
# File 'lib/after_the_deadline.rb', line 119 def style @style end |