Class: QueryCounter::Stat
- Inherits:
-
Object
- Object
- QueryCounter::Stat
- Defined in:
- lib/query_counter/stat.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #increment(duration, by = 1) ⇒ Object
-
#initialize ⇒ Stat
constructor
A new instance of Stat.
Constructor Details
#initialize ⇒ Stat
Returns a new instance of Stat.
6 7 8 9 |
# File 'lib/query_counter/stat.rb', line 6 def initialize @count = 0 @time = 0.0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
3 4 5 |
# File 'lib/query_counter/stat.rb', line 3 def count @count end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
3 4 5 |
# File 'lib/query_counter/stat.rb', line 3 def time @time end |
Instance Method Details
#increment(duration, by = 1) ⇒ Object
11 12 13 14 |
# File 'lib/query_counter/stat.rb', line 11 def increment(duration, by=1) @count += by @time += duration end |