Sha256: 91024104f48a388bd95b2e216dfc17b06e94a2331e61d0168e1e5fb253f75b87
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true module Dry module Types # Implication type # # @api public class Implication include Composition def self.operator = :> # @param [Object] input # # @return [Object] # # @api private def call_unsafe(input) if left.try(input).success? right.call_unsafe(input) else input end end # @param [Object] input # # @return [Object] # # @api private def call_safe(input, &) if left.try(input).success? right.call_safe(input, &) else input end end # @param [Object] input # # @api public def try(input) if left.try(input).success? right.try(input) else Result::Success.new(input) end end # @param [Object] value # # @return [Boolean] # # @api private def primitive?(value) if left.primitive?(value) right.primitive?(value) else true end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-types-1.8.0 | lib/dry/types/implication.rb |