class ConceptQL::SqlFormatter
Public Instance Methods
command?(name)
click to toggle source
# File lib/conceptql/sql_formatter.rb, line 13 def command?(name) `which #{name}` $?.success? end
format(sql)
click to toggle source
# File lib/conceptql/sql_formatter.rb, line 3 def format(sql) if command?(formatter) sql, _ = Open3.capture2(formatter, stdin_data: sql) return sql end return sql rescue return sql end
formatter()
click to toggle source
# File lib/conceptql/sql_formatter.rb, line 18 def formatter 'pg_format' end