Sha256: dace1e12766c5618610e0584b20c75572fb8b659569d7721c656464b78a445da
Contents?: true
Size: 1.09 KB
Versions: 6
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true class Serega module Plugins module Metadata class MetaAttribute class CheckOpts class << self # # Validates attribute options # Checks used options are allowed and then checks options values. # # @param opts [Hash] Attribute options # @param attribute_keys [Array<Symbol>] Allowed options keys # # @raise [Error] when attribute has invalid options # # @return [void] # def call(opts, attribute_keys) opts.each_key do |key| next if attribute_keys.include?(key.to_sym) raise Error, "Invalid option #{key.inspect}. Allowed options are: #{attribute_keys.map(&:inspect).join(", ")}" end check_each_opt(opts) end private def check_each_opt(opts) CheckOptHideEmpty.call(opts) CheckOptHideNil.call(opts) end end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems