README.md in alter-0.0.1 vs README.md in alter-0.0.2
- old
+ new
@@ -38,12 +38,20 @@
Now you can run that item through the processor by passing the `KumbayaProcessor` class to the process method. The process method also accepts an array of processors.
<pre lang="ruby"><code>
text.process KumbayaProcessor
+text.value
# result: "Your language is great"
</code></pre>
+
+Calling process returns the altered item. Items have the following attributes:
+
+- `value` - the current value of the item
+- `input` - the original input of the item
+- `options` - the original options passed to the item
+- `history` - a history of every item alteration
You will also have access to any `options` passed to the processor. Here is a class making use of `options`.
<pre lang="ruby"><code>
class EligibilityProcessor < Alter::Processor
@@ -56,18 +64,20 @@
end
end
text = Alter::Item.new "Your language sucks", :age => 37
text.process [KumbayaProcessor, EligibilityProcessor]
+text.value
# result: "Your language is great and you could run for President"
</code></pre>
You can just as easily chain or separate these process calls. Options can also be passed to the process method if you only want them available to specific processors.
<pre lang="ruby"><code>
text = Alter::Item.new "Your language sucks"
text.process KumbayaProcessor
text.process EligibilityProcessor, :age => 33
+text.value
# result: "Your language is great but you're too young to be President"
</code></pre>
### History