Class: Bookwatch::Config::Checkers::ProductsChecker
- Inherits:
-
Object
- Object
- Bookwatch::Config::Checkers::ProductsChecker
- Defined in:
- lib/bookwatch/config/checkers/products_checker.rb
Constant Summary collapse
- MissingProductsKeyError =
Class.new(RuntimeError)
- MissingProductIdError =
Class.new(RuntimeError)
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
20 21 22 |
# File 'lib/bookwatch/config/checkers/products_checker.rb', line 20 def config @config end |
Instance Method Details
#check(config) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bookwatch/config/checkers/products_checker.rb', line 8 def check(config) @config = config if section_product_ids.count > 0 if config.products.empty? MissingProductsKeyError.new('You must specify at least one product under the products key in config.yml') elsif missing_products.count != 0 MissingProductIdError.new("Your config.yml is missing required product id under the products key. Required product ids are #{missing_products.join(", ")}.") end end end |