Sha256: 11e341058ce0b47f45fdaf4463c3b199731fcddcb699b5cf2b76b38154065d74
Contents?: true
Size: 1.1 KB
Versions: 7
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true class Serega module SeregaValidations module Attribute # # Attribute `:method` option validator # class CheckOptMethod class << self # # Checks attribute :method 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?(:method) check_usage_with_other_params(opts, block) Utils::CheckOptIsStringOrSymbol.call(opts, :method) end private def check_usage_with_other_params(opts, block) raise SeregaError, "Option :method can not be used together with option :const" if opts.key?(:const) raise SeregaError, "Option :method can not be used together with option :value" if opts.key?(:value) raise SeregaError, "Option :method can not be used together with block" if block end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems