class Bookwatch::Config::Checkers::ProductsChecker
Constants
- MissingProductIdError
- MissingProductsKeyError
Attributes
config[R]
Public Instance Methods
check(config)
click to toggle source
# 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
Private Instance Methods
missing_products()
click to toggle source
# File lib/bookwatch/config/checkers/products_checker.rb, line 24 def missing_products section_product_ids - config.products.map(&:id) end
section_product_ids()
click to toggle source
# File lib/bookwatch/config/checkers/products_checker.rb, line 28 def section_product_ids config.sections.map(&:product_id).compact.uniq end