Class: Bookwatch::Config::Checkers::ArchiveMenuChecker
- Inherits:
-
Object
- Object
- Bookwatch::Config::Checkers::ArchiveMenuChecker
- Defined in:
- lib/bookwatch/config/checkers/archive_menu_checker.rb
Constant Summary collapse
- MissingArchiveMenuPartialError =
Class.new(RuntimeError)
- ArchiveMenuNotDefinedError =
Class.new(RuntimeError)
- EmptyArchiveItemsError =
Class.new(RuntimeError)
Instance Method Summary collapse
- #check(config) ⇒ Object
-
#initialize(file_system_accessor) ⇒ ArchiveMenuChecker
constructor
A new instance of ArchiveMenuChecker.
Constructor Details
#initialize(file_system_accessor) ⇒ ArchiveMenuChecker
Returns a new instance of ArchiveMenuChecker.
9 10 11 |
# File 'lib/bookwatch/config/checkers/archive_menu_checker.rb', line 9 def initialize(file_system_accessor) @file_system_accessor = file_system_accessor end |
Instance Method Details
#check(config) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/bookwatch/config/checkers/archive_menu_checker.rb', line 13 def check(config) partial_location = './master_middleman/source/archive_menus/_default.erb' if config. && config..include?(nil) EmptyArchiveItemsError.new 'Did you forget to add a value to the archive_menu?' elsif config. && !file_system_accessor.file_exist?(partial_location) MissingArchiveMenuPartialError.new "You must provide a template partial named at #{partial_location}" end end |