README.md in decanter-0.8.1 vs README.md in decanter-0.8.2
- old
+ new
@@ -382,11 +382,11 @@
---
Parsers are composable! Suppose you want a parser that takes an incoming percentage like "50.3%" and converts it into a float for your database like .503. You could implement this with:
```ruby
-class PercentParser < ValueParser
+class PercentParser < Decanter::Parser::ValueParser
REGEX = /(\d|[.])/
parser do |val, options|
my_float = val.scan(REGEX).join.try(:to_f)
my_float / 100 if my_float
@@ -395,10 +395,10 @@
```
This works, but it duplicates logic that already exists in `FloatParser`. Instead, you can specify a parser that should always run before your parsing logic, then you can assume that your parser receives a float:
```ruby
-class SmartPercentParser < ValueParser
+class SmartPercentParser < Decanter::Parser::ValueParser
pre :float
parser do |val, options|
val / 100