Current section
12 Versions
Jump to
Current section
12 Versions
Compare versions
3
files changed
+9
additions
-3
deletions
| @@ -1,6 +1,6 @@ | |
| 1 1 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/acalejos/flint">>}]}. |
| 2 2 | {<<"name">>,<<"flint">>}. |
| 3 | - {<<"version">>,<<"0.3.0">>}. |
| 3 | + {<<"version">>,<<"0.3.1">>}. |
| 4 4 | {<<"description">>, |
| 5 5 | <<"Declarative Ecto embedded schemas for data validation, coercion, and manipulation.">>}. |
| 6 6 | {<<"elixir">>,<<"~> 1.14">>}. |
| @@ -137,12 +137,17 @@ defmodule Flint.Type do | |
| 137 137 | |
| 138 138 | using = quote(do: use(unquote(module_for_type(type)))) |
| 139 139 | |
| 140 | + reflection = |
| 141 | + quote do |
| 142 | + def base_type, do: unquote(extends) |
| 143 | + end |
| 144 | + |
| 140 145 | init = |
| 141 146 | if type == Ecto.ParameterizedType do |
| 142 147 | quote do |
| 143 148 | def init(opts) do |
| 144 149 | opts = opts ++ unquote(opts) |
| 145 | - unquote(extends).init(opts) |
| 150 | + unquote(extends).init(opts) |> Map.put_new(:extends, unquote(extends)) |
| 146 151 | end |
| 147 152 | end |
| 148 153 | end |
| @@ -150,6 +155,7 @@ defmodule Flint.Type do | |
| 150 155 | quoted = |
| 151 156 | ([ |
| 152 157 | using, |
| 158 | + reflection, |
| 153 159 | init |
| 154 160 | ] ++ |
| 155 161 | callbacks) |
| @@ -5,7 +5,7 @@ defmodule Flint.MixProject do | |
| 5 5 | [ |
| 6 6 | app: :flint, |
| 7 7 | name: "Flint", |
| 8 | - version: "0.3.0", |
| 8 | + version: "0.3.1", |
| 9 9 | elixir: "~> 1.14", |
| 10 10 | start_permanent: Mix.env() == :prod, |
| 11 11 | deps: deps(), |