Sha256: 9fd7d693c18ab49fed529807b7fe3ebae4d68cba3a39a9901a8d5bac1866a735

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

# Metaractor
Adds parameter validation and error control to [interactor](https://github.com/collectiveidea/interactor).

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'metaractor'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install metaractor

## Usage
```ruby
class HighFiveUser
  include Metaractor

  required or: [:user_id, :user]

  before do
    context.user ||= User.find(context.user_id)
    context.user_id ||= context.user.id
  end

  def call
    context.user.update_attributes!(high_five: true)
    # If using rails, you can add private delegates for required parameters.
    # user.update_attributes!(high_five: true)
  end

  # private
  # delegate :user, to: context
end
```

See Interactor's [README](https://github.com/collectiveidea/interactor/blob/master/README.md) for more information.

## Development

- `docker build -t outstand/metaractor .`
- `docker run -it --rm -v $(pwd):/metaractor outstand/metaractor` to run specs

To release a new version:
- Update the version number in `version.rb` and commit the result.
- `docker build -t outstand/metaractor .`
- `docker run -it --rm -v ~/.gitconfig:/root/.gitconfig -v ~/.gitconfig.user:/root/.gitconfig.user -v ~/.ssh/id_rsa:/root/.ssh/id_rsa -v ~/.gem:/root/.gem outstand/metaractor rake release`

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/outstand/metaractor.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metaractor-0.5.0 README.md