Class: Streamliner::Counter

Inherits:
Object
  • Object
show all
Defined in:
lib/streamliner/counter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller, counter) ⇒ Counter

Returns a new instance of Counter.



8
9
10
11
12
# File 'lib/streamliner/counter.rb', line 8

def initialize(controller, counter)
  @controller = controller
  @counter = counter || Hash.new(0)
  ensure_start_date
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



6
7
8
# File 'lib/streamliner/counter.rb', line 6

def controller
  @controller
end

#counterObject (readonly)

Returns the value of attribute counter.



6
7
8
# File 'lib/streamliner/counter.rb', line 6

def counter
  @counter
end

Instance Method Details

#addObject



14
15
16
17
# File 'lib/streamliner/counter.rb', line 14

def add
  counter[controller] += 1
  counter
end