Sha256: 04ca972be8691a66b0c45961c4f8087bdb0502c2337c9676f5ca23d6c838d107

Contents?: true

Size: 480 Bytes

Versions: 1

Compression:

Stored size: 480 Bytes

Contents

module TrimBlobs
  module ActiveRecord
    module ConnectionAdapters
      module AbstractAdapter
        def log_with_blobs_trimmed(sql, name = "SQL", binds = [])
          if sql
            sql = sql.gsub(/'\\x((?:[0-9a-f]{2})+)'/) do |blob|
              (blob.size > 32) ? "'\\x#{$1[0,32]}... (TRIMMED #{blob.size} hexadecimal digits)'" : $&
            end
          end
          log_without_blobs_trimmed(sql, name, binds){ yield }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trim_blobs-0.0.1 lib/trim_blobs/active_record/connection_adapters/abstract_adapter.rb