class YeSQL::Errors::FilePathDoesNotExistError

Attributes

file_path[R]

Public Class Methods

new(file_path) click to toggle source
# File lib/yesql/errors/file_path_does_not_exist_error.rb, line 6
def initialize(file_path)
  @file_path = file_path
end

Public Instance Methods

validate_file_path_existence() click to toggle source
# File lib/yesql/errors/file_path_does_not_exist_error.rb, line 10
def validate_file_path_existence
  return if file_exists?

  raise ::NotImplementedError, message
end

Private Instance Methods

available_files() click to toggle source
# File lib/yesql/errors/file_path_does_not_exist_error.rb, line 32
def available_files
  path_files.map { |file| "- #{file}\n" }.join
end
file_exists?() click to toggle source
# File lib/yesql/errors/file_path_does_not_exist_error.rb, line 28
def file_exists?
  path_files.any? { |filename| filename.include?("#{file_path}.sql") }
end
message() click to toggle source
# File lib/yesql/errors/file_path_does_not_exist_error.rb, line 20
      def message
"\nSQL file \"#{file_path}\" does not exist in #{::YeSQL.config.path}.

Available SQL files are:

#{available_files}\n"
      end
path_files() click to toggle source
# File lib/yesql/errors/file_path_does_not_exist_error.rb, line 36
def path_files
  @path_files ||= Dir["#{::YeSQL.config.path}/**/*.sql"]
end