Sha256: 32dcafb7f346f5f23636d5ea21bdd1b37aa83176a8b2ee56ab399fb7afbfe515

Contents?: true

Size: 1.41 KB

Versions: 5

Compression:

Stored size: 1.41 KB

Contents

module PseudoCleaner
  class Configuration
    @@current_instance = nil

    # A simple configuration class for the PseudoCleaner
    #
    # Configurations:
    #   output_diagnostics  - true/false
    #                         if true, the system will use puts to output information about what it is doing...
    attr_accessor :output_diagnostics
    attr_accessor :clean_database_before_tests
    attr_accessor :reset_auto_increment
    attr_accessor :single_cleaner_set
    attr_accessor :post_transaction_analysis

    def self.current_instance
      @@current_instance ||= PseudoCleaner::Configuration.new
    end

    def initialize
      @output_diagnostics = false           # false to keep the noise level down...
      @clean_database_before_tests = false  # false because I think it will annoy developers...
      @reset_auto_increment = true          # true because I think it should be done
      @single_cleaner_set = true            # true because I hope it will improve performance
      @post_transaction_analysis = false    # should only be set true if you are searching for a problem
    end

    def self.db_connection=(connection)
      @db_connection = connection
    end

    def self.db_connection(type)
      if @db_connection || type.nil?
        @db_connection
      else
        if type == :sequel
          Sequel::DATABASES[0]
        else
          ActiveRecord::Base
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pseudo_cleaner-0.0.29 lib/pseudo_cleaner/configuration.rb
pseudo_cleaner-0.0.28 lib/pseudo_cleaner/configuration.rb
pseudo_cleaner-0.0.27 lib/pseudo_cleaner/configuration.rb
pseudo_cleaner-0.0.26 lib/pseudo_cleaner/configuration.rb
pseudo_cleaner-0.0.25 lib/pseudo_cleaner/configuration.rb