Current section
4 Versions
Jump to
Current section
4 Versions
Compare versions
6
files changed
+27
additions
-11
deletions
| @@ -1,5 +1,19 @@ | |
| 1 1 | # CHANGELOG |
| 2 2 | |
| 3 | + ## v0.3.1 |
| 4 | + |
| 5 | + ### Bug Fixes |
| 6 | + |
| 7 | + The auto-generated `@doc` for the *delegate* pattern, when the |
| 8 | + delegated function has a different name to the delegatee (`:as`) function, was |
| 9 | + using the delegated name rather than the delegatee name. |
| 10 | + |
| 11 | + The *struct_update* pattern was erroneously wrapping the result from |
| 12 | + `update/2` in an `:ok` tuple: `update/2` returns `{:ok, struct}` |
| 13 | + directly. |
| 14 | + |
| 15 | + Relaxed the dependency constraints on `Plymio.Vekil` and `Harnais.Helper`. |
| 16 | + |
| 3 17 | ## v0.3.0 |
| 4 18 | |
| 5 19 | ### Bug Fixes |
| @@ -14,9 +14,9 @@ for e.g. function clauses, pattern matching, etc. | |
| 14 14 | Add **plymio\_codi** to your list of dependencies in *mix.exs*: |
| 15 15 | |
| 16 16 | def deps do |
| 17 | - [{:plymio_codi, "~> 0.2.0"}] |
| 17 | + [{:plymio_codi, "~> 0.3.1"}] |
| 18 18 | end |
| 19 19 | |
| 20 20 | ## Examples |
| 21 21 | |
| 22 | - See the examples in the [API Reference](<https://hexdocs.pm/plymio_codi/api-reference.html>). |
| 22 | + See the examples in the [API Reference](https://hexdocs.pm/plymio_codi/api-reference.html). |
| @@ -33,5 +33,5 @@ | |
| 33 33 | {<<"name">>,<<"plymio_vekil">>}, |
| 34 34 | {<<"optional">>,false}, |
| 35 35 | {<<"repository">>,<<"hexpm">>}, |
| 36 | - {<<"requirement">>,<<"~> 0.1.0">>}]]}. |
| 37 | - {<<"version">>,<<"0.3.0">>}. |
| 36 | + {<<"requirement">>,<<">= 0.1.0">>}]]}. |
| 37 | + {<<"version">>,<<"0.3.1">>}. |
| @@ -67,10 +67,11 @@ defmodule Plymio.Codi.Pattern.Delegate do | |
| 67 67 | Delegating to a different function name (`:as`): |
| 68 68 | |
| 69 69 | iex> {:ok, {forms, _}} = [ |
| 70 | - ...> delegate: [name: :fun_3, as: :fun_tre, args: [:opts, :key, :value], module: ModuleA, doc: nil], |
| 70 | + ...> delegate: [name: :fun_3, as: :fun_tre, args: [:opts, :key, :value], module: ModuleA], |
| 71 71 | ...> ] |> produce_codi |
| 72 72 | ...> forms |> harnais_helper_format_forms! |
| 73 | - ["defdelegate(fun_3(opts, key, value), to: ModuleA, as: :fun_tre)"] |
| 73 | + ["@doc \"Delegated to `ModuleA.fun_tre/3`\"", |
| 74 | + "defdelegate(fun_3(opts, key, value), to: ModuleA, as: :fun_tre)"] |
| 74 75 | |
| 75 76 | Here a `@doc`, `@since`, and `@spec` are generated. Note in the first |
| 76 77 | example the `:spec_args` are explicily given as well as the |
| @@ -283,6 +284,7 @@ defmodule Plymio.Codi.Pattern.Delegate do | |
| 283 284 | |
| 284 285 | # the dependent doc cpo |
| 285 286 | {:ok, depend_doc_cpo} <- depend_cpo |> cpo_put_pattern(@plymio_codi_pattern_doc), |
| 287 | + {:ok, depend_doc_cpo} <- depend_doc_cpo |> cpo_put_fun_name(delegate_name), |
| 286 288 | {:ok, depend_doc_cpo} <- depend_doc_cpo |> cpo_put_fun_doc(delegate_doc), |
| 287 289 | {:ok, depend_doc_cpo} <- depend_doc_cpo |> cpo_put_fun_args(delegate_args), |
| @@ -345,7 +345,7 @@ defmodule Plymio.Codi.Pattern.Struct do | |
| 345 345 | ["def(update_x(t, value))", |
| 346 346 | "", |
| 347 347 | "def(update_x(%__MODULE__{x: _} = state, value)) do", |
| 348 | - " {:ok, state |> update(x: value)}", |
| 348 | + " state |> update(x: value)", |
| 349 349 | "end", |
| 350 350 | "", |
| 351 351 | "def(update_x(state, _value)) do", |
| @@ -1189,7 +1189,7 @@ defmodule Plymio.Codi.Pattern.Struct do | |
| 1189 1189 | def unquote(fun_name)(unquote_splicing(fun_args)) |
| 1190 1190 | |
| 1191 1191 | def unquote(fun_name)(unquote(field_match) = state, value) do |
| 1192 | - {:ok, state |> update([{unquote(field_name), value}])} |
| 1192 | + state |> update([{unquote(field_name), value}]) |
| 1193 1193 | end |
| 1194 1194 | |
| 1195 1195 | def unquote(fun_name)(state, _value) do |
Loading more files…