Class: IncludeWithRespect::Configuration
- Inherits:
-
Object
- Object
- IncludeWithRespect::Configuration
- Defined in:
- lib/include_with_respect/configuration.rb
Constant Summary collapse
- VALID_LEVELS =
%i[warning error skip silent]
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
Instance Method Summary collapse
-
#initialize(**options) ⇒ Configuration
constructor
A new instance of Configuration.
- #validate ⇒ Object
Constructor Details
#initialize(**options) ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 |
# File 'lib/include_with_respect/configuration.rb', line 8 def initialize(**) self.level = [:level] || :warning validate end |
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level.
6 7 8 |
# File 'lib/include_with_respect/configuration.rb', line 6 def level @level end |
Instance Method Details
#validate ⇒ Object
17 18 19 20 21 22 |
# File 'lib/include_with_respect/configuration.rb', line 17 def validate unexpected = (level - VALID_LEVELS) return unless unexpected.any? raise ::IncludeWithRespect::Error, "Unexpected configuration value(s) for level: #{unexpected}" end |