Current section

Files

Jump to
square_up lib norm core delegate.ex
Raw

lib/norm/core/delegate.ex

# TODO delete when https://github.com/keathley/norm/pull/96 merged and released
defmodule Norm.Core.Delegate do
@moduledoc false
defstruct [:fun]
def build(fun) when is_function(fun, 0) do
%__MODULE__{fun: fun}
end
defimpl Norm.Conformer.Conformable do
def conform(%{fun: fun}, input, path) do
Norm.Conformer.Conformable.conform(fun.(), input, path)
end
end
end