class Bookbinder::Config::Checkers::DuplicateSectionNameChecker

Constants

DuplicateSectionNameError

Public Instance Methods

check(config) click to toggle source
# File lib/bookbinder/config/checkers/duplicate_section_name_checker.rb, line 9
def check(config)
  if duplicate_section_names?(config)
    DuplicateSectionNameError.new error_message
  end
end

Private Instance Methods

duplicate_section_names?(config) click to toggle source
# File lib/bookbinder/config/checkers/duplicate_section_name_checker.rb, line 17
def duplicate_section_names?(config)
  directory_names = config.sections.map {|section|
    Ingest::DestinationDirectory.new(section.repo_name,
                                     section.desired_directory_name)
  }
  directory_names.length != directory_names.uniq.length
end
error_message() click to toggle source
# File lib/bookbinder/config/checkers/duplicate_section_name_checker.rb, line 25
        def error_message
          <<-ERROR
    Duplicate repository names are not allowed.
          ERROR
        end