Class: ConciseErrors::Configuration

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

Overview

Stores global configuration for the middleware.

Constant Summary collapse

DEFAULT_STACK_LINES =
10
DEFAULT_FORMAT =
:text

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



11
12
13
# File 'lib/concise_errors/configuration.rb', line 11

def initialize
  reset!
end

Instance Attribute Details

#application_rootObject

Returns the value of attribute application_root.



9
10
11
# File 'lib/concise_errors/configuration.rb', line 9

def application_root
  @application_root
end

#cleanerObject

Returns the value of attribute cleaner.



9
10
11
# File 'lib/concise_errors/configuration.rb', line 9

def cleaner
  @cleaner
end

#enabledObject

Returns the value of attribute enabled.



9
10
11
# File 'lib/concise_errors/configuration.rb', line 9

def enabled
  @enabled
end

#full_error_paramObject

Returns the value of attribute full_error_param.



9
10
11
# File 'lib/concise_errors/configuration.rb', line 9

def full_error_param
  @full_error_param
end

#loggerObject

Returns the value of attribute logger.



9
10
11
# File 'lib/concise_errors/configuration.rb', line 9

def logger
  @logger
end

#stack_trace_linesObject

Returns the value of attribute stack_trace_lines.



9
10
11
# File 'lib/concise_errors/configuration.rb', line 9

def stack_trace_lines
  @stack_trace_lines
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/concise_errors/configuration.rb', line 19

def enabled?
  enabled != false
end

#formatObject



15
16
17
# File 'lib/concise_errors/configuration.rb', line 15

def format
  (@format || DEFAULT_FORMAT).to_sym
end

#format=(value) ⇒ Object



23
24
25
# File 'lib/concise_errors/configuration.rb', line 23

def format=(value)
  @format = value&.to_sym
end

#reset!Object



27
28
29
30
31
32
33
34
35
# File 'lib/concise_errors/configuration.rb', line 27

def reset!
  @format = :text
  @stack_trace_lines = DEFAULT_STACK_LINES
  @enabled = true
  @logger = nil
  @application_root = nil
  @cleaner = nil
  @full_error_param = "concise_errors_full"
end