Sha256: d8643c0b5767f97ea226790b592727798131d5608c65038cd9efaf593aab16a7
Contents?: true
Size: 649 Bytes
Versions: 8
Compression:
Stored size: 649 Bytes
Contents
# frozen_string_literal: true 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| ::Dry::Logic::Rule::Predicate.build( ::Dry::Logic::Predicates[:"#{key}?"] ).curry(val).to_ast } ).reduce(:and) end # @return [Dry::Logic::RuleCompiler] # # @api private def self.rule_compiler @rule_compiler ||= ::Dry::Logic::RuleCompiler.new(::Dry::Logic::Predicates) end end end
Version data entries
8 entries across 8 versions & 1 rubygems