Sha256: 1a3c2eca6f5accba666e7c92985edf813cba155da7d3c680c8ac67ba868a4aa6
Contents?: true
Size: 514 Bytes
Versions: 4
Compression:
Stored size: 514 Bytes
Contents
# frozen_string_literal: true module Cfer module Auster class ParamValidator def initialize(&validator) raise "validator must be a Proc." unless validator.is_a?(Proc) raise "validator must be arity 2." unless validator.arity == 2 @validator = validator end def validate(parameters) raise "parameters must be a Hash." unless parameters.is_a?(Hash) errors = [] @validator.call(parameters, errors) errors end end end end
Version data entries
4 entries across 4 versions & 1 rubygems