Sha256: d042fdd5d43c1372772788b065faa6201954b6571d074db75e4055ebb51cd3f4
Contents?: true
Size: 569 Bytes
Versions: 18
Compression:
Stored size: 569 Bytes
Contents
module Datacaster class Checker < Base def initialize(error_key = nil, &block) raise "Expected block" unless block_given? @error_keys = ['.check', 'datacaster.errors.check'] @error_keys.unshift(error_key) if error_key @check = block end def cast(object, runtime:) if Runtimes::Base.(runtime, @check, object) Datacaster.ValidResult(object) else Datacaster.ErrorResult(I18nValues::Key.new(@error_keys, value: object)) end end def inspect "#<Datacaster::Checker>" end end end
Version data entries
18 entries across 18 versions & 1 rubygems