Sha256: 8154f0c005b0569f24416a954c7696f7db5e26951c383cbe18a7f0c201f2b9e8
Contents?: true
Size: 874 Bytes
Versions: 5
Compression:
Stored size: 874 Bytes
Contents
# frozen_string_literal: true module Yoti class Validation # # @param value # @param [String] name # def self.assert_not_nil(value, name) return unless value.nil? raise(ArgumentError, "#{name} must not be nil") end # # @param [Class] type # @param value # @param [String] name # @param [Boolean] nilable # def self.assert_is_a(type, value, name, nilable = false) return if nilable && value.nil? return if value.is_a?(type) raise(ArgumentError, "#{name} must be a #{type.name}") end # # @param [Symbol] method # @param value # @param [String] name # def self.assert_respond_to(method, value, name) assert_not_nil(value, name) return if value.respond_to?(method) raise(ArgumentError, "#{name} must respond to #{method}") end end end
Version data entries
5 entries across 5 versions & 1 rubygems