Class: Rollgeist::Configuration
- Inherits:
-
Object
- Object
- Rollgeist::Configuration
- Defined in:
- lib/rollgeist/configuration.rb
Constant Summary collapse
- MODES =
%i[log raise].freeze
Instance Attribute Summary collapse
-
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
-
#ignore_if ⇒ Object
Returns the value of attribute ignore_if.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_reports_per_request ⇒ Object
Returns the value of attribute max_reports_per_request.
- #mode ⇒ Object
-
#warn_on_global_id ⇒ Object
Returns the value of attribute warn_on_global_id.
-
#warn_on_resave ⇒ Object
Returns the value of attribute warn_on_resave.
-
#warn_on_serialization ⇒ Object
Returns the value of attribute warn_on_serialization.
-
#warn_once ⇒ Object
Returns the value of attribute warn_once.
Instance Method Summary collapse
- #enabled_in?(environment) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
- #watchpoint_enabled?(watchpoint) ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rollgeist/configuration.rb', line 17 def initialize @enabled_environments = %w[development test] @ignore_if = nil @logger = nil @max_reports_per_request = 5 @mode = nil @warn_once = true @warn_on_global_id = true @warn_on_resave = false @warn_on_serialization = true end |
Instance Attribute Details
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
7 8 9 |
# File 'lib/rollgeist/configuration.rb', line 7 def enabled_environments @enabled_environments end |
#ignore_if ⇒ Object
Returns the value of attribute ignore_if.
7 8 9 |
# File 'lib/rollgeist/configuration.rb', line 7 def ignore_if @ignore_if end |
#logger ⇒ Object
Returns the value of attribute logger.
7 8 9 |
# File 'lib/rollgeist/configuration.rb', line 7 def logger @logger end |
#max_reports_per_request ⇒ Object
Returns the value of attribute max_reports_per_request.
7 8 9 |
# File 'lib/rollgeist/configuration.rb', line 7 def max_reports_per_request @max_reports_per_request end |
#mode ⇒ Object
29 30 31 |
# File 'lib/rollgeist/configuration.rb', line 29 def mode @mode || (Rollgeist.environment == "test" ? :raise : :log) end |
#warn_on_global_id ⇒ Object
Returns the value of attribute warn_on_global_id.
7 8 9 |
# File 'lib/rollgeist/configuration.rb', line 7 def warn_on_global_id @warn_on_global_id end |
#warn_on_resave ⇒ Object
Returns the value of attribute warn_on_resave.
7 8 9 |
# File 'lib/rollgeist/configuration.rb', line 7 def warn_on_resave @warn_on_resave end |
#warn_on_serialization ⇒ Object
Returns the value of attribute warn_on_serialization.
7 8 9 |
# File 'lib/rollgeist/configuration.rb', line 7 def warn_on_serialization @warn_on_serialization end |
#warn_once ⇒ Object
Returns the value of attribute warn_once.
7 8 9 |
# File 'lib/rollgeist/configuration.rb', line 7 def warn_once @warn_once end |
Instance Method Details
#enabled_in?(environment) ⇒ Boolean
33 34 35 |
# File 'lib/rollgeist/configuration.rb', line 33 def enabled_in?(environment) enabled_environments.map(&:to_s).include?(environment.to_s) end |
#validate! ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/rollgeist/configuration.rb', line 46 def validate! validate_mode! validate_limit! validate_ignore_predicate! validate_environments! self end |
#watchpoint_enabled?(watchpoint) ⇒ Boolean
37 38 39 40 41 42 43 44 |
# File 'lib/rollgeist/configuration.rb', line 37 def watchpoint_enabled?(watchpoint) case watchpoint when :serialization then warn_on_serialization when :global_id then warn_on_global_id when :resave then warn_on_resave else false end end |