Module: Simple::SQL::Formatting

Extended by:
Formatting
Included in:
Formatting
Defined in:
lib/simple/sql/formatting.rb

Constant Summary collapse

MAX_LENGTH =
500

Instance Method Summary collapse

Instance Method Details

#format(sql, *args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/simple/sql/formatting.rb', line 8

def format(sql, *args)
  sql = format_sql(sql)

  return sql if args.empty?

  args = args.map(&:inspect).join(", ")
  sql += " w/args: #{args}"
  sql = sql[0, (MAX_LENGTH - 3)] + "..." if sql.length > MAX_LENGTH
  sql
end