README.md in tableware-0.2.0 vs README.md in tableware-0.2.1

- old
+ new

@@ -33,11 +33,13 @@ The downside is that everything is treated as a string, so you may need to do some `.to_i`ing to convert things back into the type you're expecting. However, this is a one-time cost and [optimising for reading code is a good idea](http://va.lent.in/optimize-for-readability-first/). This isn't always going to be better than defining your data in another format, but it is another option. Or perhaps you just like Cucumber scenario outlines and want something similar in rspec! -You can also focus a single row, to help with debugging, by prepending a line with `>`. +### Focus a single row + +You can focus a single row, to help with debugging, by prepending a line with `>`. For example: ```ruby words = ' Foo | Bar > Yay | Woo @@ -45,9 +47,21 @@ Tableware.arrays(words) #=> [ ['Yay', 'Woo'] ] ``` +### Focus multiple rows + +Running multiple rows cannot be achieved with prepending `>`. Instead, use [Enum#select](https://ruby-doc.org/core-2.3.1/Enumerable.html#method-i-select) (or `reject`) to decide which lines to process. For the the previous example, you could achieve the same result using select as follows: + +```ruby +words = ' Foo | Bar + Yay | Woo + Zip | Zap ' + +Tableware.arrays(words).select{ |row| row.first == 'Yay' } + #=> [ ['Yay', 'Woo'] ] +``` This gem has been created as a quick experiment to see if or how often this feature could be useful. If you find it useful, please like it or better yet, extend it!