Class: Devformance::Configuration

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

Constant Summary collapse

VALID_FRAMEWORKS =
i[rspec minitest].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



33
34
35
36
37
38
39
40
# File 'lib/devformance.rb', line 33

def initialize
  @log_file_path = "devformance.log"
  @slow_query_threshold_ms = 100
  @preferred_framework = :rspec
  @coverage_enabled = true
  @coverage_dir = "coverage"
  @coverage_minimum_coverage = 80
end

Instance Attribute Details

#coverage_dirObject

Returns the value of attribute coverage_dir.



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

def coverage_dir
  @coverage_dir
end

#coverage_enabledObject

Returns the value of attribute coverage_enabled.



28
29
30
# File 'lib/devformance.rb', line 28

def coverage_enabled
  @coverage_enabled
end

#coverage_minimum_coverageObject

Returns the value of attribute coverage_minimum_coverage.



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

def coverage_minimum_coverage
  @coverage_minimum_coverage
end

#log_file_pathObject

Returns the value of attribute log_file_path.



28
29
30
# File 'lib/devformance.rb', line 28

def log_file_path
  @log_file_path
end

#preferred_frameworkObject

Returns the value of attribute preferred_framework.



28
29
30
# File 'lib/devformance.rb', line 28

def preferred_framework
  @preferred_framework
end

#slow_query_threshold_msObject

Returns the value of attribute slow_query_threshold_ms.



28
29
30
# File 'lib/devformance.rb', line 28

def slow_query_threshold_ms
  @slow_query_threshold_ms
end

Instance Method Details

#coverage?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/devformance.rb', line 59

def coverage?
  @coverage_enabled != false
end

#framework_adapterObject



50
51
52
53
54
55
56
57
# File 'lib/devformance.rb', line 50

def framework_adapter
  return nil unless @preferred_framework

  framework_class = Devformance::TestFramework::Registry.for_name(@preferred_framework.to_s)
  return nil unless framework_class && defined?(Rails)

  framework_class.new(Rails.root)
end