return_helpers v0.1.0 ReturnHelpers

Simple library that adds a piping possibility for easy returning

Imagine

  socket =
    socket
    |> assign(valid: true)
  {:noreply, socket}

to write like:

  socket
  |> assign(valid: true)
  |> noreply()

Looks cleaner ?

Link to this section Summary

Link to this section Functions

Link to this function

noreply(state, params)

Link to this function

noreply(state, params, other)

Examples

iex(2)> socket = %{}
%{}
iex(3)> socket |> ok()
{:ok, %{}}
iex(4)> socket |> noreply()
{:noreply, %{}}
Link to this function

ok(return, params)

Link to this function

reply(reply, state)

Link to this function

reply(return, state, other)

Link to this function

stop(reason, state)

Link to this function

stop(reason, reply, state)