README.md in csv_decision-0.4.0 vs README.md in csv_decision-0.4.1
- old
+ new
@@ -18,14 +18,14 @@
### Why use `csv_decision`?
Typical "business logic" is notoriously illogical - full of corner cases and one-off
exceptions.
-A decision table can express data-based decisions in a way that comes more naturally
-to subject matter experts, who typically prefer spreadsheet models.
-Business logic may then be encapsulated, avoiding the need to write tortuous
-conditional expressions in Ruby that draw the ire of `rubocop` and its ilk.
+A decision table can express data-based decisions in a way that comes naturally
+to subject matter experts, who typically use spreadsheet models.
+Business logic can be encapsulated in a table, avoiding the need for tortuous conditional
+expressions.
This gem and the examples below take inspiration from
[rufus/decision](https://github.com/jmettraux/rufus-decision).
(That gem is no longer maintained and CSV Decision has better
decision-time performance, at the expense of slower table parse times and more memory --
@@ -73,11 +73,11 @@
The ordering of rows matters. `Ernest`, who is in charge of `finance` for the rest of
the world, except for `America` and `Europe`, *must* come after his colleagues
`Charlie` and `Donald`. `Zach` has been placed last, catching all the input combos
not matching any other row.
-Here is the example as code:
+Here's the example as code:
```ruby
# Valid CSV string
data = <<~DATA
in :topic, in :region, out :team_member
@@ -125,11 +125,11 @@
### CSV Decision features
* Either returns the first matching row as a hash (default), or accumulates all matches as an
array of hashes (i.e., `parse` option `first_match: false` or CSV file option `accumulate`).
* Fast decision-time performance (see `benchmarks` folder). Automatically indexes all
- text-only columns that do not contain any empty strings.
+ constants-only columns that do not contain any empty strings.
* In addition to simple strings, `csv_decision` can match basic Ruby constants (e.g., `=nil`),
regular expressions (e.g., `=~ on|off`), comparisons (e.g., `> 100.0` ) and
Ruby-style ranges (e.g., `1..10`)
* Can compare an input column versus another input hash key - e.g., `> :column`.
* Any cell starting with `#` is treated as a comment, and comments may appear anywhere in the
@@ -196,10 +196,11 @@
, no
DATA
```
These comparison operators are also supported: `!=`, `>`, `>=`, `<`, `<=`.
In addition, you can also apply a Ruby 0-arity method - e.g., `.present?` or `.nil?`. Negation is
-also supported - e.g., `!.nil?`.
+also supported - e.g., `!.nil?`. Note that `.nil?` can also be written as `:= nil?`, and `!.nil?`
+as `:= !nil?`, depending on preference.
For more simple examples see `spec/csv_decision/examples_spec.rb`.
#### Input `guard` conditions
Sometimes it's more convenient to write guard expressions in a single column specialized for that purpose.
\ No newline at end of file