Class: YmlBuilder::Stats
- Inherits:
-
Object
- Object
- YmlBuilder::Stats
- Defined in:
- lib/yml_builder/stats.rb
Instance Attribute Summary collapse
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
- #add(key, value) ⇒ Object
- #init_class ⇒ Object
-
#initialize ⇒ Stats
constructor
A new instance of Stats.
Constructor Details
#initialize ⇒ Stats
Returns a new instance of Stats.
5 6 7 |
# File 'lib/yml_builder/stats.rb', line 5 def initialize init_class end |
Instance Attribute Details
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
3 4 5 |
# File 'lib/yml_builder/stats.rb', line 3 def stats @stats end |
Instance Method Details
#add(key, value) ⇒ Object
17 18 19 |
# File 'lib/yml_builder/stats.rb', line 17 def add(key, value) @stats[key] += value end |
#init_class ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/yml_builder/stats.rb', line 9 def init_class @stats = Hash.new @stats[:categories] = 0 @stats[:total] = 0 @stats[:available] = 0 @stats[:price] = 0 end |