Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
drexed committed Oct 2, 2024
1 parent ac13a57 commit 7b4b4a6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ Or install it yourself as:
* [Setup](#setup)
* [Execution](#execution)
* [Context](#context)
* [States](#states)
* [Statuses](#statuses)
* [Callbacks](#callbacks)
* [State Hooks](#status_hooks)
* [Execution Hooks](#execution_hooks)
* [Status Hooks](#status_hooks)
* [States](#states)
* [Generator](#generator)

## Setup

Defining a command is as simple as adding a call method.
Defining a command is as simple as adding a call method to a command object (required).

```ruby
class CalculatePower < Lite::Command::Base
Expand All @@ -45,9 +45,16 @@ class CalculatePower < Lite::Command::Base
# TODO: implement calculator
end

private

# Domain logic...

end
```

> [!TIP]
> You should make all of your domain logic private so that only the command API is exposed.
## Execution

Executing a command can be done as an instance or class call.
Expand Down Expand Up @@ -166,6 +173,9 @@ command.noop?("idk") #=> false
command.reason #=> "Anything to the power of 1 is 1"
```

> [!NOTE]
> There is no `success!` method as its the default status.
## Callbacks

Use callbacks to run arbituary code at transition points and
Expand Down

0 comments on commit 7b4b4a6

Please sign in to comment.