Class: Html2rss::Config::SelectorsValidator
- Inherits:
-
Dry::Validation::Contract
- Object
- Dry::Validation::Contract
- Html2rss::Config::SelectorsValidator
- Defined in:
- lib/html2rss/config/selectors_validator.rb
Overview
Validates the configuration hash for :selectors.
Defined Under Namespace
Classes: Enclosure, Items, Selector
Constant Summary collapse
- NESTING_KEY =
Required wrapper key used to validate dynamic selector names.
:dynamic_keys_workaround
Class Method Summary collapse
-
.call(config) ⇒ Dry::Validation::Result
Shortcut to validate the config.
Class Method Details
.call(config) ⇒ Dry::Validation::Result
Shortcut to validate the config.
163 164 165 166 167 168 169 |
# File 'lib/html2rss/config/selectors_validator.rb', line 163 def self.call(config) # dry-validation/schema does not support "Dynamic Keys" yet: https://github.com/dry-rb/dry-schema/issues/37 # But :selectors contains mostly "dynamic" keys, as the user defines them to extract article attributes. # --> Validate the dynamic keys manually. # To be able to specify a `rule`, nest the config under NESTING_KEY and mark that as `required`. new.call(NESTING_KEY => config) end |