Sha256: e52048bd10c01a6c83d04e005b6d4519188440b783be0ee8ed65e246d9b8e0da
Contents?: true
Size: 1.07 KB
Versions: 13
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true class Serega module SeregaValidations module Attribute # # Attribute `:key` option validator # class CheckOptKey class << self # # Checks attribute :key option # # @param opts [Hash] Attribute options # # @raise [SeregaError] SeregaError that option has invalid value # # @return [void] # def call(opts, block = nil) return unless opts.key?(:key) check_usage_with_other_params(opts, block) Utils::CheckOptIsStringOrSymbol.call(opts, :key) end private def check_usage_with_other_params(opts, block) raise SeregaError, "Option :key can not be used together with option :const" if opts.key?(:const) raise SeregaError, "Option :key can not be used together with option :value" if opts.key?(:value) raise SeregaError, "Option :key can not be used together with block" if block end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems