Class: Bookbinder::Config::Checkers::SubnavTopicsChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/bookbinder/config/checkers/subnav_topics_checker.rb

Constant Summary collapse

MissingRequiredKeyError =
Class.new(RuntimeError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



15
16
17
# File 'lib/bookbinder/config/checkers/subnav_topics_checker.rb', line 15

def config
  @config
end

Instance Method Details

#check(config) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/bookbinder/config/checkers/subnav_topics_checker.rb', line 7

def check(config)
  @config = config

  if invalid_products.any?
    MissingRequiredKeyError.new("Your config.yml is missing required key(s) for subnav_topics in product id(s) #{invalid_product_ids}. Required keys are #{required_topic_keys.join(", ")}.")
  end
end