I have this documentation laying around for dry-logic I used internally for the company I'm currently working for. I thought it might be useful for others, besides me and my colleagues.
To verify that examples I wrote for the documentation actually worked I decided to write a simple predicate/operation builder. I'm not sure how this could be incorporated into the documentation or if it belongs elsewhere (maybe as an extension?) but I decided to include it here as the documentation is written around it. We might want to polish the documentation further before we decided to merge it–if we decide to merge it.
The so called "builder" found in docs/builder.html.md defines a DSL for operations and predicates and was written to make the documentation less verbose.
extend Build
is_num = build do
int? | float? | number?
end
is_num.call(10).success? # => true
is_num.call('ten').success? # => false
Let me know if this can be useful and what changes you would like to see.
The pull request contains
Runnable examples for all predicates & operations
A builder for predicates, operations, and custom predicates
Specs for the documented examples using the builder.
I have this documentation laying around for dry-logic I used internally for the company I'm currently working for. I thought it might be useful for others, besides me and my colleagues.
To verify that examples I wrote for the documentation actually worked I decided to write a simple predicate/operation builder. I'm not sure how this could be incorporated into the documentation or if it belongs elsewhere (maybe as an extension?) but I decided to include it here as the documentation is written around it. We might want to polish the documentation further before we decided to merge it–if we decide to merge it.
The so called "builder" found in
docs/builder.html.md
defines a DSL for operations and predicates and was written to make the documentation less verbose.Let me know if this can be useful and what changes you would like to see.
The pull request contains