{"repo":"nxt-insurance/nxt_state_machine","free":true,"listed":false,"github":"https://github.com/nxt-insurance/nxt_state_machine","clone":"git clone https://github.com/nxt-insurance/nxt_state_machine.git","description":"A simple but powerful state machine implementation.","language":"Ruby","stars":16,"topics":["state-machine","aasm","ruby","ruby-on-rails","activerecord","workflow","workflow-engine"],"license":"MIT","category":"workflow-automation","readme_excerpt":"NxtStateMachine NxtStateMachine is a simple state machine library that ships with an easy to use integration for ActiveRecord. It was build with the intend in mind to make it easy to implement other integrations. Beside the ActiveRecord integration, it ships with in memory adapters for Hash and attr accessor. Installation Add this line to your application's Gemfile: And then execute: $ bundle Or install it yourself as: $ gem install nxt state machine Usage ActiveRecord Example ActiveRecord In order to use nxt state machine with ActiveRecord simply include NxtStateMachine::ActiveRecord into your class. This does not necessarily have to be a model (thus an instance of ActiveRecord) itself. If you are a fan of the single responsibility principle you might want to put your workflow logic in a separate class instead of into the model directly. Therefore simply define the target of your state machine as follows. This enables you to split up complex workflows into multiple classes (maybe orchestrated by another toplevel workflow). If you do not provide a specific target, an instance of the class you include nxt state machine into will be the target (most likely your model). Define which object holds your state with the target: option Define which attribute holds your state with the state attr: option Customize which attribute is used to persist and fetch your state with state machine(state attr: :state) do . If this is not customized, nxt state machine assumes your target has a :sta","default_branch":null,"files":null,"tree":[],"storefront":"/r/nxt-insurance","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/nxt-insurance/nxt_state_machine/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}