Class: Flog::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/flog/status.rb

Constant Summary collapse

SWITCH_FILE_NAME =
"no-flog.txt"
SQL_SWITCH_FILE_NAME =
"no-flog-sql.txt"
PARAMS_SWITCH_FILE_NAME =
"no-flog-params.txt"

Class Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/flog/status.rb', line 10

def self.enabled?
  !switch_file_exists?(SWITCH_FILE_NAME)
rescue
  true
end

.params_formattable?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
# File 'lib/flog/status.rb', line 22

def self.params_formattable?
  enabled? && !switch_file_exists?(PARAMS_SWITCH_FILE_NAME)
rescue
  true
end

.sql_formattable?Boolean

Returns:

  • (Boolean)


16
17
18
19
20
# File 'lib/flog/status.rb', line 16

def self.sql_formattable?
  enabled? && !switch_file_exists?(SQL_SWITCH_FILE_NAME)
rescue
  true
end

.switch_file_exists?(file_name) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/flog/status.rb', line 29

def self.switch_file_exists?(file_name)
  File.exist?(Rails.root.join("tmp", file_name).to_s)
end