README.md in viator-0.1.0 vs README.md in viator-0.1.1
- old
+ new
@@ -4,11 +4,11 @@
```ruby
result = User.create('pogs_for_life', 'password', 'pogsandhorses@geocities.com')
if result.success?
- do_something result.value
+ do_something(result.value)
else
result.errors.each { |e| do_something_else(e) }
end
```
@@ -28,25 +28,34 @@
$ gem install viator
## Usage
```ruby
-eh = Viator.new # create a new error handler
-eh.success? # true
-eh.failure? # false
-eh.count # 0
-eh.errors # []
+eh = Viator.new # create a new error handler
+eh.success? # true
+eh.failure? # false
+eh.count # 0
+eh.errors # []
eh.report 'argument invalid!'
-eh.success? # false
-eh.count # 1
-eh.errors # ['argument invalid!']
+eh.success? # false
+eh.count # 1
+eh.errors # ['argument invalid!']
eh.reset
-eh.success? # true
+eh.success? # true
eh.value = 'arbitrary data'
-eh.value # returns 'nil' if eh.failure?
+eh.value # returns 'nil' if eh.failure?
+
+# Less Important
+
+eh = Viator.new(hide_value: false)
+eh.value = 'berries'
+eh.report 'There has been an error'
+eh.value # nil
+eh.hide_value = true
+eh.value # 'berries'
```
## Contributing
Bug reports and pull requests are welcome on Bitbucket at https://bitbucket.org/surdegg/viator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.