README.md in clomp-0.0.3 vs README.md in clomp-0.0.4
- old
+ new
@@ -1,6 +1,6 @@
-# Clomp [![CircleCI](https://circleci.com/gh/rubyrider/Clomp.svg?style=svg)](https://circleci.com/gh/rubyrider/Clomp)
+# Clomp [![CircleCI](https://circleci.com/gh/rubyrider/clomp.svg?style=svg)](https://circleci.com/gh/rubyrider/clomp)
**Clomp gem provides a smooth, lightweight, productive and reusable way to build an operation using Railway oriented programing paradigm.**
Clomp will give you an easy interface to complete your service operation. You can use it with any framework
or plain ruby object.
## Installation
@@ -25,22 +25,42 @@
specific step.
Consider the following class:
```ruby
+class AnotherOperation < Clomp::Operation
+ track :track_from_another_operation
+
+ def track_from_another_operation(options)
+ options[:hello_from_another_operation] = true
+ end
+end
+
class SingingOperation < Clomp::Operation
- # this block only executes on successful steps!
+ # Configure your operation for common tracks,
+ # configuration can be overridden from individual tracks
+ setup do |config|
+ config.pass_fast = true
+ config.fail_fast = true
+ config.optional = true
+ end
+
+ # this block only executes on failure step!
# pass options to receive the operation states!
add_track :get_lyrics do |options|
- # we call this a success state based block!
+ # we call this a failure state based block!
options[:do_some_thing] = 10
end
add_track :get_instruments_ready
add_track :start_signing
+ # We can now share specific step from
+ # outsider operation
+ share :track_from_another_operation, from: AnotherOperation # Or 'AnotherOperation'
+
finally :receive_price #final step, wont execute after this step!
def get_instruments_ready(options, mutable_data: , **)
# do anything!
end
@@ -58,10 +78,10 @@
end
end
```
```ruby
-@result = SingingOperation.({singer_name: 'Base Baba'})
+@result = SingingOperation[singer_name: 'Base Baba']
@result.success? # => true
@result.failure? # => false
```
## Development