Sha256: d3ff93c285ff9f53ff92e8364b8e6b1ffbc838fc281cee73f2ccaf9f4e198361
Contents?: true
Size: 578 Bytes
Versions: 1
Compression:
Stored size: 578 Bytes
Contents
# frozen_string_literal: true module Strict class Return class << self def make(validator = Validators::Anything.instance, coerce: false) new(validator: validator, coercer: coerce) end end attr_reader :validator, :coercer def initialize(validator:, coercer:) @validator = validator @coercer = coercer end def valid?(value) return true unless Strict.configuration.validate? validator === value end def coerce(value) return value unless coercer coercer.call(value) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
strict-1.5.0 | lib/strict/return.rb |