Class: RouteGuard::Configuration
- Inherits:
-
Object
- Object
- RouteGuard::Configuration
- Defined in:
- lib/route_guard/configuration.rb
Constant Summary collapse
- ALL_RULES =
%i[ duplicate_routes shadowed_routes unreachable_routes duplicate_helpers duplicate_resources unused_routes statistics complexity ].freeze
Instance Attribute Summary collapse
-
#except ⇒ Object
Returns the value of attribute except.
-
#fail_on_warning ⇒ Object
Returns the value of attribute fail_on_warning.
-
#formatters ⇒ Object
Returns the value of attribute formatters.
-
#only ⇒ Object
Returns the value of attribute only.
-
#rules ⇒ Object
Returns the value of attribute rules.
-
#strict ⇒ Object
Returns the value of attribute strict.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #enabled_rules ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
18 19 20 21 22 23 24 25 26 |
# File 'lib/route_guard/configuration.rb', line 18 def initialize @rules = ALL_RULES.dup @formatters = [:terminal] @strict = false @fail_on_warning = false @only = [] @except = [] @verbose = false end |
Instance Attribute Details
#except ⇒ Object
Returns the value of attribute except.
5 6 7 |
# File 'lib/route_guard/configuration.rb', line 5 def except @except end |
#fail_on_warning ⇒ Object
Returns the value of attribute fail_on_warning.
5 6 7 |
# File 'lib/route_guard/configuration.rb', line 5 def fail_on_warning @fail_on_warning end |
#formatters ⇒ Object
Returns the value of attribute formatters.
5 6 7 |
# File 'lib/route_guard/configuration.rb', line 5 def formatters @formatters end |
#only ⇒ Object
Returns the value of attribute only.
5 6 7 |
# File 'lib/route_guard/configuration.rb', line 5 def only @only end |
#rules ⇒ Object
Returns the value of attribute rules.
5 6 7 |
# File 'lib/route_guard/configuration.rb', line 5 def rules @rules end |
#strict ⇒ Object
Returns the value of attribute strict.
5 6 7 |
# File 'lib/route_guard/configuration.rb', line 5 def strict @strict end |
#verbose ⇒ Object
Returns the value of attribute verbose.
5 6 7 |
# File 'lib/route_guard/configuration.rb', line 5 def verbose @verbose end |
Instance Method Details
#enabled_rules ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/route_guard/configuration.rb', line 28 def enabled_rules active_rules = if only.any? rules & only.map(&:to_sym) else rules end active_rules - except.map(&:to_sym) end |