Sha256: c79ec6de51791d86d01d6e64d111b2645ca6287606fa86750aa04eb34236c098

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

module BetterRailsDebugger
  class Configuration
    include Singleton

    attr_reader :mongoid_config_file

    def initialize
      Mongoid.logger.level = Logger::FATAL
    end

    # Set MongoID configuration file
    def mongoid_config_file=(file_path)
      raise LoadError.new "File #{file_path} not found" if !File.exist? file_path
      @mongoid_config_file = file_path
    end

    # Skip globally, the analysis of all classes added here
    def skip_classes=(list)
      return @skip_classes if @skip_classes
      raise ArgumentError.new "Expected Array, got #{list.class}" if !list.kind_of? Array
      raise ArgumentError.new "Array must contain classes and mondules names only" if list.any? {|a| !a.class.kind_of?(Class)}
      @skip_classes ||= list
    end

    def skip_classes
      @skip_classes || []
    end

    private

    def classes_to_skip
      @classes_to_skip ||= ruby_classes + skip_classes
    end

    def ruby_classes
      @ruby_classes ||= %w{

      }.map(&:constantize)
    end
  end

  def self.configure(&block)
    block.call Configuration.instance
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
better_rails_debugger-0.2.1 lib/better_rails_debugger/config.rb
better_rails_debugger-0.2.0 lib/better_rails_debugger/config.rb
better_rails_debugger-0.1.1 lib/better_rails_debugger/config.rb
better_rails_debugger-0.0.4 lib/better_rails_debugger/config.rb
better_rails_debugger-0.0.3 lib/better_rails_debugger/config.rb
better_rails_debugger-0.0.2 lib/better_rails_debugger/config.rb
better_rails_debugger-0.0.1 lib/better_rails_debugger/config.rb