module YeSQL::Utils::Read

Public Instance Methods

statement(readable: false) click to toggle source
# File lib/yesql/utils/read.rb, line 6
def statement(readable: false)
  read_file(found_file, readable)
end

Private Instance Methods

dir_sql_files() click to toggle source
# File lib/yesql/utils/read.rb, line 22
def dir_sql_files
  Dir["./#{::YeSQL.config.path}/**/*.sql"]
end
found_file() click to toggle source
# File lib/yesql/utils/read.rb, line 18
def found_file
  dir_sql_files.find { |dir_file_path| dir_file_path.include?("#{file_path}.sql") }
end
read_file(file, readable) click to toggle source
# File lib/yesql/utils/read.rb, line 12
def read_file(file, readable)
  return File.readlines(file, chomp: true).join(" ") if readable == true

  File.read(file)
end