0.2.0 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
MIT - MIT LicenseThe finite state machine implementations for Elixir.
aasm
to your list of dependencies in mix.exs
:def deps do
[
{:aasm, "~> 0.2.0"}
]
end
defmodule Dummy.Order do
@moduledoc """
Order model
"""
use Ecto.Schema
import AASM
aasm :state do
state(~w(state_created state_assigned state_finished state_closed)a)
event(:handle_assigned, %{from: ~w(state_created)a, to: :state_assigned}, fn changeset ->
changeset
end)
event(:handle_finished, %{from: ~w(state_assigned)a, to: :state_finished}, fn changeset ->
changeset
end)
event(
:handle_closed,
%{from: ~w(state_created state_assigned state_finished)a, to: :state_closed},
fn changeset -> changeset end
)
end
schema "orders" do
field(:state, :string)
end
end
Bug report or pull request are welcome.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Please write unit test with your code if necessary.
The gem is available as open source under the terms of the MIT License.