Class: DeadCodeDetector::Configuration
- Inherits:
-
Object
- Object
- DeadCodeDetector::Configuration
- Defined in:
- lib/dead_code_detector/configuration.rb
Constant Summary collapse
- STORAGE_BACKENDS =
{ memory: Storage::MemoryBackend, redis: Storage::RedisBackend, }
Instance Attribute Summary collapse
-
#allowed ⇒ Object
Returns the value of attribute allowed.
-
#cache_expiry ⇒ Object
Returns the value of attribute cache_expiry.
-
#classes_to_monitor ⇒ Object
Returns the value of attribute classes_to_monitor.
-
#error_handler ⇒ Object
Returns the value of attribute error_handler.
-
#ignore_paths ⇒ Object
Returns the value of attribute ignore_paths.
-
#max_seconds_to_enable ⇒ Object
Returns the value of attribute max_seconds_to_enable.
-
#redis ⇒ Object
Returns the value of attribute redis.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #storage ⇒ Object
- #storage=(backend_type) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 |
# File 'lib/dead_code_detector/configuration.rb', line 11 def initialize @allowed = true @classes_to_monitor = [] @cache_expiry = 60 * 60 * 24 * 14 @max_seconds_to_enable = 1 end |
Instance Attribute Details
#allowed ⇒ Object
Returns the value of attribute allowed.
4 5 6 |
# File 'lib/dead_code_detector/configuration.rb', line 4 def allowed @allowed end |
#cache_expiry ⇒ Object
Returns the value of attribute cache_expiry.
4 5 6 |
# File 'lib/dead_code_detector/configuration.rb', line 4 def cache_expiry @cache_expiry end |
#classes_to_monitor ⇒ Object
Returns the value of attribute classes_to_monitor.
4 5 6 |
# File 'lib/dead_code_detector/configuration.rb', line 4 def classes_to_monitor @classes_to_monitor end |
#error_handler ⇒ Object
Returns the value of attribute error_handler.
4 5 6 |
# File 'lib/dead_code_detector/configuration.rb', line 4 def error_handler @error_handler end |
#ignore_paths ⇒ Object
Returns the value of attribute ignore_paths.
4 5 6 |
# File 'lib/dead_code_detector/configuration.rb', line 4 def ignore_paths @ignore_paths end |
#max_seconds_to_enable ⇒ Object
Returns the value of attribute max_seconds_to_enable.
4 5 6 |
# File 'lib/dead_code_detector/configuration.rb', line 4 def max_seconds_to_enable @max_seconds_to_enable end |
#redis ⇒ Object
Returns the value of attribute redis.
4 5 6 |
# File 'lib/dead_code_detector/configuration.rb', line 4 def redis @redis end |
Instance Method Details
#storage ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/dead_code_detector/configuration.rb', line 22 def storage if @storage @storage else raise "#{self.class.name}#storage is not configured" end end |
#storage=(backend_type) ⇒ Object
18 19 20 |
# File 'lib/dead_code_detector/configuration.rb', line 18 def storage=(backend_type) @storage ||= STORAGE_BACKENDS.fetch(backend_type).new end |