README.md in multi_string_replace-2.0.0 vs README.md in multi_string_replace-2.0.1
- old
+ new
@@ -38,10 +38,20 @@
You can also pass in a Proc, these will only get evaluated when the token is encountered. The start and end replace position will passed to the proc.
```ruby
MultiStringReplace.replace("The quick brown fox jumps over the lazy dog brown", {'brown' => 'black', 'fox' => ->(s, e) { "cat" }})
+# => "The quick black cat jumps over the lazy dog black"
+
+# returning nil will cause the substitution to be ignored.
+MultiStringReplace.replace("The quick brown fox jumps over the lazy dog brown", {'brown' => 'black', 'fox' => ->(s, e) { nil }})
+# => "The quick black fox jumps over the lazy dog black"
+
+MultiStringReplace.replace("The quick brown fox jumps over the lazy dog brown", {'brown' => 'black', 'fox' => ->(s, e) { "" }})
+# => "The quick black jumps over the lazy dog black"
```
+
+This should allow for very fast and simple templating systems.
Also adds a mreplace method to String which does the same thing:
```ruby
"The quick brown fox jumps over the lazy dog brown".mreplace({'brown' => 'black', 'fox' => ->(_, _) { "cat" }})