lib/remnant/database.rb in remnant-0.3.1 vs lib/remnant/database.rb in remnant-0.3.2
- old
+ new
@@ -31,18 +31,19 @@
return result
end
def reset
@suppress = true
+ @total_time = nil
Thread.current['remnant.database.queries'] = []
end
def queries
Thread.current['remnant.database.queries'] ||= []
end
def total_time
- @total_time ||= (queries.inject(0) {|memo, query| memo + query.time}) * 1000
+ @total_time ||= queries.map(&:time).sum * 1000
end
end
extend ClassMethods
end
end