mirror of
https://github.com/ash-project/reactor.git
synced 2024-09-20 05:13:16 +12:00
26 lines
608 B
Elixir
26 lines
608 B
Elixir
|
defmodule Example.BasicReactor do
|
||
|
@moduledoc false
|
||
|
use Reactor
|
||
|
|
||
|
defmodule DrinkingAgeVerifier do
|
||
|
@moduledoc false
|
||
|
use Reactor.Step
|
||
|
|
||
|
def run(arguments, _context, _options) when arguments.age >= 18 and arguments.country == :nz,
|
||
|
do: {:ok, true}
|
||
|
|
||
|
def run(arguments, _context, _options) when arguments.age >= 21 and arguments.country == :usa,
|
||
|
do: {:ok, true}
|
||
|
|
||
|
def run(_arguments, _context, _options), do: {:ok, false}
|
||
|
end
|
||
|
|
||
|
input :age
|
||
|
input :country
|
||
|
|
||
|
step :verify, DrinkingAgeVerifier do
|
||
|
argument :age, input(:age)
|
||
|
argument :country, input(:country)
|
||
|
end
|
||
|
end
|