Sha256: 0335054ee66f745332f9910ffc8d9a3481e7bdf2e0fe5489340f9210e1b991d3

Contents?: true

Size: 421 Bytes

Versions: 7

Compression:

Stored size: 421 Bytes

Contents

# frozen_string_literal: true

class Serega
  module SeregaValidations
    module Utils
      class CheckAllowedKeys
        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

7 entries across 7 versions & 1 rubygems

Version Path
serega-0.6.1 lib/serega/validations/utils/check_allowed_keys.rb
serega-0.6.0 lib/serega/validations/utils/check_allowed_keys.rb
serega-0.5.2 lib/serega/validations/utils/check_allowed_keys.rb
serega-0.5.1 lib/serega/validations/utils/check_allowed_keys.rb
serega-0.5.0 lib/serega/validations/utils/check_allowed_keys.rb
serega-0.4.0 lib/serega/validations/utils/check_allowed_keys.rb
serega-0.3.0 lib/serega/validations/utils/check_allowed_keys.rb