Skip to content

Commit

Permalink
Small readme fix
Browse files Browse the repository at this point in the history
  • Loading branch information
naps62 committed Feb 11, 2023
1 parent 7545193 commit a6b3e75
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
A Finite-state machine implementation in Elixir, with opt-in Ecto friendliness.

Highlights:
* Plays nicely with both bare Elixir structs and Ecto changesets
* Ability to wrap transitions inside an Ecto.Multi for atomic updates
* Guides you in the right direction when it comes to [side effects](#a-note-on-side-effects)

---
- Plays nicely with both bare Elixir structs and Ecto changesets
- Ability to wrap transitions inside an Ecto.Multi for atomic updates
- Guides you in the right direction when it comes to [side effects](#a-note-on-side-effects)

* [Installation](#installation)
* [Usage](#usage)
* [Simple state machine](#simple-state-machine)
* [Callbacks before transitions](#callbacks-before-transitions)
* [Validating transitions](#validating-transitions)
* [Decoupling logic from data](#decoupling-logic-from-data)
* [Ecto support](#ecto-support)
* [Transition changesets](#transition-changesets)
* [Transition with Ecto.Multi](#transition-with-ecto-multi)
* [A note on side effects](#a-note-on-side-effects)
* [Contributing](#a-note-on-side-effects)
---

- [Installation](#installation)
- [Usage](#usage)
- [Simple state machine](#simple-state-machine)
- [Callbacks before transitions](#callbacks-before-transitions)
- [Validating transitions](#validating-transitions)
- [Decoupling logic from data](#decoupling-logic-from-data)
- [Ecto support](#ecto-support)
- [Transition changesets](#transition-changesets)
- [Transition with Ecto.Multi](#transition-with-ecto-multi)
- [A note on side effects](#a-note-on-side-effects)
- [Contributing](#contributing)

## Installation

Expand Down Expand Up @@ -68,7 +68,6 @@ Fsmx.transition(struct, "four")
# {:error, "invalid transition from one to four"}
```


### Callbacks before transitions

You can implement a `before_transition/3` callback to mutate the struct when before a transition happens.
Expand All @@ -94,7 +93,6 @@ Fsmx.transition(struct, "three")
# {:ok, %App.StateMachine{state: "three", data: %{foo: :bar}}
```


### Validating transitions

The same `before_transition/3` callback can be used to add custom validation logic, by returning an `{:error, _}` tuple
Expand Down Expand Up @@ -256,7 +254,6 @@ it, 100% is a pipe dream), then this simple library might not be for you.

Consider looking at [`Sage`][sage], for instance.


```elixir
# this is *probably* fine
Ecto.Multi.new()
Expand Down

0 comments on commit a6b3e75

Please sign in to comment.