Sha256: 997992cbf226215da9f34c981f3334d41083ec3ea8921f5836e6e7c24412e0b3

Contents?: true

Size: 1.41 KB

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
pseudo_cleaner-0.0.30 lib/pseudo_cleaner/configuration.rb