Explicitly `unquote(isn_type)` in Isn.Base
This gets rid of `@isn_type` in Isn.Base. It was only ever there because I had to store it somewhere, since compile-time macro parameters are not available to a function at runtime.
This commit is contained in:
parent
15385bfc6b
commit
e012413a35
|
|
@ -77,10 +77,10 @@ defmodule Isn.Base do
|
||||||
|> String.replace(~r(.+\.), "")
|
|> String.replace(~r(.+\.), "")
|
||||||
isn_type = ecto_type
|
isn_type = ecto_type
|
||||||
|> String.downcase
|
|> String.downcase
|
||||||
|
|> String.to_atom
|
||||||
|
|
||||||
quote bind_quoted: [isn_type: isn_type, ecto_type: ecto_type] do
|
quote bind_quoted: [isn_type: isn_type, ecto_type: ecto_type] do
|
||||||
@behaviour Ecto.Type
|
@behaviour Ecto.Type
|
||||||
@isn_type isn_type
|
|
||||||
|
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Definition for the #{isn_type} module.
|
Definition for the #{isn_type} module.
|
||||||
|
|
@ -97,8 +97,7 @@ defmodule Isn.Base do
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def type,
|
def type, do: unquote(isn_type)
|
||||||
do: @isn_type
|
|
||||||
|
|
||||||
defdelegate blank?, to: Ecto.Type
|
defdelegate blank?, to: Ecto.Type
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue