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.



5
6
7
# File 'lib/yml_builder/stats.rb', line 5

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



17
18
19
# File 'lib/yml_builder/stats.rb', line 17

def add(key, value)
  @stats[key] += value
end

#init_classObject



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