Module: QuoteSql::Formater
- Included in:
- QuoteSql
- Defined in:
- lib/quote_sql/formater.rb
Constant Summary collapse
- PG_FORMAT_BIN =
`which pg_format`.chomp.presence
Instance Method Summary collapse
- #dsql ⇒ Object
- #to_formatted_sql ⇒ Object (also: #to_sqf)
Instance Method Details
#dsql ⇒ Object
5 6 7 8 |
# File 'lib/quote_sql/formater.rb', line 5 def dsql puts to_formatted_sql nil end |
#to_formatted_sql ⇒ Object Also known as: to_sqf
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/quote_sql/formater.rb', line 10 def to_formatted_sql sql = respond_to?(:to_sql) ? to_sql : to_s Niceql::Prettifier.prettify_sql(sql) # IO.popen(PG_FORMAT_BIN, "r+", err: "/dev/null") do |f| # f.write(sql) # f.close_write # f.read # end rescue sql end |