Class: SqlTracker::Config

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Configurable
Defined in:
lib/sql_tracker/config.rb

Class Method Summary collapse

Class Method Details

.apply_defaultsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sql_tracker/config.rb', line 9

def apply_defaults
  self.enabled = enabled.nil? ? true : enabled
  self.tracked_paths ||= %w(app lib)
  self.tracked_sql_command ||= %w(SELECT INSERT UPDATE DELETE)
  self.output_path ||= begin
    if defined?(::Rails) && ::Rails.root
      File.join(::Rails.root.to_s, 'tmp')
    else
      'tmp'
    end
  end
  self
end