Sha256: 08ff082e34ae6909110d95830cb4875fb44f417ea63c02de843c82ee6294115e
Contents?: true
Size: 505 Bytes
Versions: 4
Compression:
Stored size: 505 Bytes
Contents
require 'dry/logic/rule_compiler' require 'dry/logic/predicates' module Dry module Types module Predicates include Logic::Predicates predicate(:type?) do |type, value| value.kind_of?(type) end end def self.Rule(options) rule_compiler.( options.map { |key, val| [:val, [:predicate, [:"#{key}?", [val]]]] } ).reduce(:and) end def self.rule_compiler @rule_compiler ||= Logic::RuleCompiler.new(Types::Predicates) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dry-types-0.7.2 | lib/dry/types/constraints.rb |
dry-types-0.7.1 | lib/dry/types/constraints.rb |
dry-types-0.7.0 | lib/dry/types/constraints.rb |
dry-types-0.6.0 | lib/dry/types/constraints.rb |