Class: YmlBuilder::Stats

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStats

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

#statsObject (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_classObject



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