Sha256: 827c255e1c07b1f956845524c20da15f346629618a7934f6d367cf3918f56674

Contents?: true

Size: 1.53 KB

Versions: 12

Compression:

Stored size: 1.53 KB

Contents

# Reactor

Warning: this is under active development!

This gem aims to provide the following tools to augment your ActiveRecord & Sidekiq stack.

 1. Barebones event API through Sidekiq to publish whatever you want
 2. Database-driven API to manage subscribers so that users may rewire whatever you let them (transactional emails, campaigns, etc...)
 3. Static/Code-driven API to subscribe a basic ruby block to an event.
 4. A new communication pattern between your ActiveRecord models that runs asynchronously through Sidekiq.
    a. describe model lifecycle events and callbacks with class-level helper methods/DSL

## Installation

Add this line to your application's Gemfile:

    gem 'reactor'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install reactor

## Usage

Well, this is evolving, so it's probably best to go read the specs.


### Barebones API

   Event.publish(:event_name, any: 'data', you: 'want')

### ActiveModel extensions

#### Publishable

  Describe lifecycle events like so

    publishes :my_model_created
    publishes :state_has_changed, if: -> { state_has_changed? }

#### Subscribable

  *New in 0.3*

  You can now bind any block to an event in your models like so

    on_event :any_event do |event|
      MyModel.find(event.target).do_something_about_it!
    end

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
reactor-0.5.3 README.md
reactor-0.5.2 README.md
reactor-0.5.1 README.md
reactor-0.5.0 README.md
reactor-0.4.7 README.md
reactor-0.4.6 README.md
reactor-0.4.5 README.md
reactor-0.4.4 README.md
reactor-0.4.3 README.md
reactor-0.4.2 README.md
reactor-0.4.0 README.md
reactor-0.3.2 README.md