Sha256: 3927f2be03c3141904a89ef793eff66fe14fdf8b2bc3d0f4fe59881d53f80b48
Contents?: true
Size: 1.01 KB
Versions: 13
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true class Serega module SeregaValidations module Attribute # # Attribute `:const` option validator # class CheckOptConst class << self # # Checks attribute :const option # # @param opts [Hash] Attribute options # # @raise [SeregaError] Attribute validation error # # @return [void] # def call(opts, block = nil) return unless opts.key?(:const) check_usage_with_other_params(opts, block) end private def check_usage_with_other_params(opts, block) raise SeregaError, "Option :const can not be used together with option :key" if opts.key?(:key) raise SeregaError, "Option :const can not be used together with option :value" if opts.key?(:value) raise SeregaError, "Option :const 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