Basic support for defining module based recipes. Now with less-magic™, and not forced upon the user. User can still use use Pipette.Recipe or define its very own module/controller start.
defmodule ExampleRecipe do
use Pipette.OnDefinition
@subscribe foo: :IN
@subscribe OUT: {:foo, :*}
def foo("foo"), do: "bar"
def foo("err"), do: {:error, "err"}
def foo(val), do: val
end
defmodule AnotherExample do
use Pipette.Recipe
@subscribe foo: :IN
@subscribe OUT: {:foo, :*}
@stage foo: %Pipette.Stage{handler: fn
"foo" -> "bar"
val -> val
end}
end
Pipette.OnDefinition Assumes all public function definitions serve as a stage
Pipette.Recipe respects @stage and @subscribe module attributes by default
Changed some examples to use @stage and @subscribe
Basic support for defining module based recipes. Now with less-magic™, and not forced upon the user. User can still use
use Pipette.Recipe
or define its very own module/controller start.Pipette.OnDefinition
Assumes all public function definitions serve as a stagePipette.Recipe
respects@stage
and@subscribe
module attributes by default