Sha256: 0c9d0d5a6ad8b559aa05d51526dbb15f181d451c49172b28f6e392ed01d4179a
Contents?: true
Size: 360 Bytes
Versions: 9
Compression:
Stored size: 360 Bytes
Contents
require 'dry/logic' require 'dry/logic/predicates' include Dry::Logic user_present = Rule::Key.new(:user, Predicates[:key?]) has_min_age = Rule::Key.new(:age, Predicates[:key?]) & Rule::Value.new(:age, Predicates[:gt?].curry(18)) user_rule = user_present & has_min_age puts user_rule.(user: { age: 19 }).inspect puts user_rule.(user: { age: 18 }).inspect
Version data entries
9 entries across 9 versions & 1 rubygems