Skip to content

Commit

Permalink
release prep - updated CHANGELOG, README, incremented version
Browse files Browse the repository at this point in the history
  • Loading branch information
tomichj committed Feb 23, 2019
1 parent 6de91b9 commit 5da404b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Operate Changelog

## [0.2.0] - February 23, 2019

- `expose` a value within a handler block to the caller


## [0.1.1] - October 27, 2017

Expand Down
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Methods used in your service class:

Methods used by clients (normally a controller) of your service class:
* `#on(*events, &block)` that subscribe to an event or events, and provide a block to handle that event
* `#expose(hash)` called within a block passed to `#on` will set the hash as instance variables on the caller (typically a controller)


### A basic service
Expand Down Expand Up @@ -128,13 +129,27 @@ end


# Your client (a controller):
def create
def create
UserAddition.call(@form) do
on(:ok) {|user| logger.info "#{user.name} created" }
end
end
```

### Exposing values

You can expose a value from within a handler block to the calling controller. Pass the values to expose as a hash.

```ruby
def new
UserBuild.call(@form) do
on(:ok) do |user|
expose(user: user)
render :new # new.html.erb can access @user
end
end
end
```

## Testing

Expand Down Expand Up @@ -175,7 +190,7 @@ end

The core of Operate is based on [rectify] and [wisper], and would not exist without these fine projects.
Both rectify and wisper are excellent gems, they just provide more functionality than I require, and with
some philosophical differences in execution (rectify requires you to extend their base class, operate provides mixins).
some philosophical differences in execution (rectify requires you to extend their base class, while operate provides mixins).


## Contributing
Expand Down
2 changes: 1 addition & 1 deletion lib/operate/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Operate
VERSION = '0.1.1'
VERSION = '0.2.0'
end

0 comments on commit 5da404b

Please sign in to comment.