class Flog::Status

Status returns checke result of switch files

Constants

PARAMS_SWITCH_FILE_NAME
SQL_SWITCH_FILE_NAME
SWITCH_FILE_NAME

Public Class Methods

enabled?() click to toggle source
# File lib/flog/status.rb, line 12
def enabled?
  !switch_file_exists?(SWITCH_FILE_NAME)
rescue StandardError
  true
end
params_formattable?() click to toggle source
# File lib/flog/status.rb, line 24
def params_formattable?
  enabled? && !switch_file_exists?(PARAMS_SWITCH_FILE_NAME)
rescue StandardError
  true
end
sql_formattable?() click to toggle source
# File lib/flog/status.rb, line 18
def sql_formattable?
  enabled? && !switch_file_exists?(SQL_SWITCH_FILE_NAME)
rescue StandardError
  true
end
switch_file_base_path() click to toggle source
# File lib/flog/status.rb, line 30
def switch_file_base_path
  if Rails.root&.exist?
    Rails.root
  else
    Pathname.new(File.expand_path(File.dirname(__FILE__) + '../../'))
  end
end
switch_file_dir_path() click to toggle source
# File lib/flog/status.rb, line 38
def switch_file_dir_path
  switch_file_base_path.join('tmp')
end

Private Class Methods

switch_file_exists?(file_name) click to toggle source
# File lib/flog/status.rb, line 44
def switch_file_exists?(file_name)
  switch_file_dir_path.join(file_name).exist?
end