Sha256: 838846edbc0419620cbbeb19f8fdfc9001f8cc16dff943421ae8012b0b47ccdc
Contents?: true
Size: 730 Bytes
Versions: 7
Compression:
Stored size: 730 Bytes
Contents
# frozen_string_literal: true module Atacama # Validation execution class for a given set of parameters and options. class Validator def self.call(**context) new(**context).call end # @param options [Hash] options schema # @param context [Atacama::Context] keyword arguments to validate def initialize(options:, context:) @options = options @context = context end def call detect_invalid_types! end private attr_reader :options, :context def detect_invalid_types! options.each do |(key, parameter)| raise ArgumentError, "option not found: #{key}" unless context.key?(key) parameter.valid? context[key] end end end end
Version data entries
7 entries across 7 versions & 1 rubygems