Class: Streamliner::Counter
- Inherits:
-
Object
- Object
- Streamliner::Counter
- Defined in:
- lib/streamliner/counter.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#counter ⇒ Object
readonly
Returns the value of attribute counter.
Instance Method Summary collapse
- #add ⇒ Object
-
#initialize(controller, counter) ⇒ Counter
constructor
A new instance of Counter.
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
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
6 7 8 |
# File 'lib/streamliner/counter.rb', line 6 def controller @controller end |
#counter ⇒ Object (readonly)
Returns the value of attribute counter.
6 7 8 |
# File 'lib/streamliner/counter.rb', line 6 def counter @counter end |
Instance Method Details
#add ⇒ Object
14 15 16 17 |
# File 'lib/streamliner/counter.rb', line 14 def add counter[controller] += 1 counter end |