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:
Martin Frost 2015-06-10 08:24:24 +02:00
parent 15385bfc6b
commit e012413a35
1 changed files with 2 additions and 3 deletions

View File

@ -77,10 +77,10 @@ defmodule Isn.Base do
|> String.replace(~r(.+\.), "")
isn_type = ecto_type
|> String.downcase
|> String.to_atom
quote bind_quoted: [isn_type: isn_type, ecto_type: ecto_type] do
@behaviour Ecto.Type
@isn_type isn_type
@moduledoc """
Definition for the #{isn_type} module.
@ -97,8 +97,7 @@ defmodule Isn.Base do
end
"""
def type,
do: @isn_type
def type, do: unquote(isn_type)
defdelegate blank?, to: Ecto.Type