class SqlReporter::Total

Attributes

cached_query_diff[RW]
duration_diff[RW]
query_diff[RW]

Public Class Methods

new() click to toggle source
# File lib/sql_reporter/total.rb, line 6
def initialize
  @query_diff = 0
  @duration_diff = 0
  @cached_query_diff = 0
end

Public Instance Methods

+(total) click to toggle source
# File lib/sql_reporter/total.rb, line 38
def +(total)
  self.class.new(query_diff + total.query_diff, duration_diff + total.duration_diff, cached_query_diff + total.cached_query_diff)
end
duration_msg() click to toggle source
# File lib/sql_reporter/total.rb, line 30
def duration_msg
  "\nDuration #{duration_diff > 0 ? 'gain' : 'decrease' }[ms]: #{duration_diff.abs.round(2)}\n"
end
queries_msg() click to toggle source
# File lib/sql_reporter/total.rb, line 26
def queries_msg
  "\nQueries count change: #{query_diff}\n" 
end
query_drop() click to toggle source
# File lib/sql_reporter/total.rb, line 22
def query_drop
  query_diff > 0 ? 0 : -query_diff
end
query_gain() click to toggle source
# File lib/sql_reporter/total.rb, line 18
def query_gain
  query_diff > 0 ? query_diff : 0
end
summary() click to toggle source
# File lib/sql_reporter/total.rb, line 34
def summary
   queries_msg + duration_msg + "\n"
end