Sha256: 3ae8184dfb8ac357067fc31a4fc118f81f300b895c9151623f70ed75a65c732a
Contents?: true
Size: 1.84 KB
Versions: 3
Compression:
Stored size: 1.84 KB
Contents
[gem]: https://rubygems.org/gems/dry-logic [travis]: https://travis-ci.org/dry-rb/dry-logic [gemnasium]: https://gemnasium.com/dry-rb/dry-logic [codeclimate]: https://codeclimate.com/github/dry-rb/dry-logic [coveralls]: https://coveralls.io/r/dry-rb/dry-logic [inchpages]: http://inch-ci.org/github/dry-rb/dry-logic # dry-logic [](https://gitter.im/dry-rb/chat) [][gem] [][travis] [][gemnasium] [][codeclimate] [][codeclimate] [][inchpages] Predicate logic and rule composition used by: * [dry-types](https://github.com/dry-rb/dry-types) for constrained types * [dry-validation](https://github.com/dry-rb/dry-validation) for composing validation rules * your project...? ## Synopsis ``` ruby require 'dry/logic' require 'dry/logic/predicates' include Dry::Logic user_present = Rule::Key.new(Predicates[:key?], name: :user) has_min_age = Rule::Key.new( Predicates[:key?]) & Rule::Value.new(:age, Predicates[:gt?].curry(18), name: :age ) user_rule = user_present & has_min_age user_rule.(user: { age: 19 }) # #<Dry::Logic::Result::Value success?=true input=19 rule=#<Dry::Logic::Rule::Value name=:age predicate=#<Dry::Logic::Predicate id=:gt?>>> user_rule.(user: { age: 18 }) # #<Dry::Logic::Result::Value success?=false input=18 rule=#<Dry::Logic::Rule::Value name=:age predicate=#<Dry::Logic::Predicate id=:gt?>>> ``` ## License See `LICENSE` file.
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dry-logic-0.2.3 | README.md |
dry-logic-0.2.2 | README.md |
dry-logic-0.2.1 | README.md |