Sha256: 214c774613e69efc83f150a8e9d10f045bd6a988af7c346c4a35e3956ffc80c2
Contents?: true
Size: 722 Bytes
Versions: 2
Compression:
Stored size: 722 Bytes
Contents
# frozen_string_literal: true require "dry/logic/rule_compiler" require "dry/logic/predicates" require "dry/logic/rule/predicate" module Dry # Helper methods for constraint types # # @api public module Types # @param [Hash] options # # @return [Dry::Logic::Rule] # # @api public def self.Rule(options) rule_compiler.( options.map { |key, val| Logic::Rule::Predicate.build( Logic::Predicates[:"#{key}?"] ).curry(val).to_ast } ).reduce(:and) end # @return [Dry::Logic::RuleCompiler] # # @api private def self.rule_compiler @rule_compiler ||= Logic::RuleCompiler.new(Logic::Predicates) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-types-1.5.1 | lib/dry/types/constraints.rb |
dry-types-1.5.0 | lib/dry/types/constraints.rb |