class AutoSqlFormatter::Searcher

Public Class Methods

do(file_text) click to toggle source
# File lib/auto_sql_formatter/searcher.rb, line 6
def do(file_text)
  ExportStrings::Core.execute(file_text).each_with_object([]) { |str, memo| memo << str if sql?(str) }
end

Private Class Methods

sql?(str) click to toggle source

sqlであるという定義は一旦selectとfromを持っているということにする

# File lib/auto_sql_formatter/searcher.rb, line 13
def sql?(str)
  !!(str.match(/select/i) && str.match(/from/i))
end