Class: Html2rss::Selectors::Config
- Inherits:
-
Dry::Validation::Contract
- Object
- Dry::Validation::Contract
- Html2rss::Selectors::Config
- Defined in:
- lib/html2rss/selectors/config.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.
114 115 116 117 118 119 120 |
# File 'lib/html2rss/selectors/config.rb', line 114 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 |