Class: QueryCounter::Stat

Inherits:
Object
  • Object
show all
Defined in:
lib/query_counter/stat.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStat

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

#countObject (readonly)

Returns the value of attribute count.



3
4
5
# File 'lib/query_counter/stat.rb', line 3

def count
  @count
end

#timeObject (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