Sha256: 61fda31923eb96742045c84effe42d78f7a77bc5f981a476424ade3093cdc47d
Contents?: true
Size: 842 Bytes
Versions: 15
Compression:
Stored size: 842 Bytes
Contents
# frozen_string_literal: true module ActiveRecord module QueryLogs class LegacyFormatter # :nodoc: def initialize @key_value_separator = ":" end # Formats the key value pairs into a string. def format(pairs) pairs.map! do |key, value| "#{key}#{key_value_separator}#{format_value(value)}" end.join(",") end private attr_reader :key_value_separator def format_value(value) value end end class SQLCommenter < LegacyFormatter # :nodoc: def initialize @key_value_separator = "=" end def format(pairs) pairs.sort_by! { |pair| pair.first.to_s } super end private def format_value(value) "'#{ERB::Util.url_encode(value)}'" end end end end
Version data entries
15 entries across 15 versions & 1 rubygems