Sha256: 64b1d5553f0a619a0d3cde5ddc093c3dd3850e89cc756f2cc1bcf627ccd14a3b
Contents?: true
Size: 803 Bytes
Versions: 13
Compression:
Stored size: 803 Bytes
Contents
# frozen_string_literal: true class Serega module SeregaValidations # # Validations Utilities # module Utils # # Utility to check all hash keys are allowed # class CheckAllowedKeys # Checks hash keys are allowed # # @param opts [Hash] Some options Hash # @param allowed_keys [Array] Allowed hash keys # # @raise [Serega::SeregaError] error when any hash key is not allowed # # @return [void] def self.call(opts, allowed_keys) opts.each_key do |key| next if allowed_keys.include?(key) raise SeregaError, "Invalid option #{key.inspect}. Allowed options are: #{allowed_keys.map(&:inspect).join(", ")}" end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems