class SqlReporter::Query
Attributes
cached_count[RW]
count[RW]
duration[RW]
sql[RW]
Public Class Methods
new(s, c, d, cc)
click to toggle source
# File lib/sql_reporter/query.rb, line 12 def initialize(s, c, d, cc) @sql = s @count = c @duration = d @cached_count = cc end
null(query_name)
click to toggle source
# File lib/sql_reporter/query.rb, line 8 def self.null(query_name) self.new(query_name, 0, 0, 0) end
Public Instance Methods
+(other)
click to toggle source
# File lib/sql_reporter/query.rb, line 19 def +(other) self.class.new(sql, count + other.count, duration + other.duration, cached_count + other.cached_count) end
-(other)
click to toggle source
# File lib/sql_reporter/query.rb, line 23 def -(other) self.class.new(sql, count - other.count, duration - other.duration, cached_count - other.cached_count) end
duration_formatted()
click to toggle source
# File lib/sql_reporter/query.rb, line 31 def duration_formatted duration&.round(2) end
post_decimal_score(max_count)
click to toggle source
# File lib/sql_reporter/query.rb, line 27 def post_decimal_score(max_count) count * (1 / (max_count + 1)) end