Sha256: 6127d662c71cf1a07bb4387765e9caef886dc1daff22d5b4d6101e5205ee1b21
Contents?: true
Size: 743 Bytes
Versions: 4
Compression:
Stored size: 743 Bytes
Contents
module RailsLiveDashboard module Recorders class QueryRecorder def initialize(event) @event = event end def execute Query.create( batch_id: RailsLiveDashboard::Context.instance.batch_id, content: build_content ) end private def build_content payload = @event.payload { name: payload[:name], sql: payload[:sql].strip.gsub(/(^(\s+)?$\n)/, ''), parameters: payload[:type_casted_binds], duration: (@event.end - @event.time).round(2), kind: payload[:sql].match(/INSERT|UPDATE|DELETE/) ? 'WRITE' : 'READ', cached: payload[:cached] ? true : false } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems