README.md in lou-0.2.0 vs README.md in lou-0.2.1
- old
+ new
@@ -15,10 +15,13 @@
require 'lou'
class HashTransformer
extend Lou::Transformer
+ # optional
+ reverse_on RuntimeError
+
step.up do |x|
x.merge(a_new_key: 'this is new')
end.down do |x|
x.delete(:a_new_key)
x
@@ -39,10 +42,12 @@
# [:an_old_key, "this is old", :a_new_key, "this is new"]
original = HashTransformer.reverse(result)
# {:an_old_key=>"this is old"}
~~~
-The transforms are applied in the order that they're defined using the ~apply~ function, with each transform receiving the result of the previous one. The process can be reversed using the ~reverse~ function. Note that for each step, the input is the result of the previous step.
+The steps are applied in the order that they're defined, when the ~apply~ method is called, with each step receiving the result of the previous one. The process can be reversed using the ~reverse~ method. Note that for each step, the input is the result of the previous step.
+
+If ~reverse_on~ is defined, then any completed steps will be reversed if the exception specified is raised.
Transformers inherit the steps of their parent class, so it's possible to reuse steps by using inheritance.
Credits
-------
\ No newline at end of file