Class: ActiveRecord::SqlCommenter::QueryLogs::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/sql_commenter/query_logs_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFormatter

Returns a new instance of Formatter.



9
10
11
# File 'lib/active_record/sql_commenter/query_logs_formatter.rb', line 9

def initialize
  @key_value_separator = "="
end

Instance Attribute Details

#key_value_separatorObject (readonly)

Returns the value of attribute key_value_separator.



7
8
9
# File 'lib/active_record/sql_commenter/query_logs_formatter.rb', line 7

def key_value_separator
  @key_value_separator
end

Instance Method Details

#quote_value(value) ⇒ String

pairs.

Parameters:

  • value (string)

Returns:

  • (String)

    The formatted value that will be used in our key-value



16
17
18
# File 'lib/active_record/sql_commenter/query_logs_formatter.rb', line 16

def quote_value(value)
  "'#{value.gsub("'", "\\\\'")}'"
end