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.
6 7 8 |
# File 'lib/yml_builder/stats.rb', line 6 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
20 21 22 |
# File 'lib/yml_builder/stats.rb', line 20 def add(key, value) @stats[key] += value end |
#init_class ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/yml_builder/stats.rb', line 11 def init_class @stats = Hash.new @stats[:categories] = 0 @stats[:total] = 0 @stats[:available] = 0 @stats[:price] = 0 end |