Sha256: 1e60a1970ecb7061e4f95df3f86edb8e707e4f98541dd01e4e1f6a157576729b

Contents?: true

Size: 1.19 KB

Versions: 14

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require_relative 'preprocessed_word_validatable'

module LittleWeasel
  module Preprocessors
    # This module provides methods to validate preprocessed words types.
    # rubocop: disable Layout/LineLength
    module PreprocessedWordsValidatable
      module_function

      # :reek:ManualDispatch, ignored - this is raising an error, not conditional code execution
      def validate_prepreprocessed_words(preprocessed_words:)
        raise ArgumentError, validation_error_message(object: preprocessed_words, respond_to: :original_word) unless preprocessed_words.respond_to? :original_word
        raise ArgumentError, validation_error_message(object: preprocessed_words, respond_to: :preprocessed_words) unless preprocessed_words.respond_to? :preprocessed_words

        preprocessed_words&.preprocessed_words&.each do |preprocessed_word|
          PreprocessedWordValidatable.validate_prepreprocessed_word preprocessed_word: preprocessed_word
        end
      end

      def validation_error_message(object:, respond_to:)
        "Argument preprocessed_words does not respond to: #{object.class}##{respond_to}"
      end
    end
    # rubocop: enable Layout/LineLength
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
LittleWeasel-5.0.13 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.12 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.11 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.10 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.9 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.8 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.7 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.6 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.5 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.4 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.3 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.2 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.1 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb
LittleWeasel-5.0.0 lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb