aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlthms <contact@thomasletan.fr>2018-01-02 20:26:05 +0000
committerThomas Letan <contact@thomasletan.fr>2018-01-24 08:11:29 +0100
commitbcf27ea41cf3d45b2bde58fda4f835d096c2f2a9 (patch)
treeb72c0727e6e8ce9455dbd6d34490a0934e2cc333
parentpuppeteer, system: Introduce cast_return and call_return (diff)
puppeteer: Rename the `key` argument of cast/call into `puppeteer_key`
-rw-r--r--lib/lkn/core/puppeteer.ex2
-rw-r--r--lib/lkn/core/specs.ex6
-rw-r--r--test/core_test.exs2
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/lkn/core/puppeteer.ex b/lib/lkn/core/puppeteer.ex
index ab373ea..ed5b526 100644
--- a/lib/lkn/core/puppeteer.ex
+++ b/lib/lkn/core/puppeteer.ex
@@ -46,6 +46,7 @@ defmodule Lkn.Core.Puppeteer do
key_type,
key_to_name,
state_type,
+ key_name: Specs.var_name("puppeteer_key"),
additional_args: [
quote do unquote(Specs.var_name("instance_key")) :: Lkn.Core.Instance.k end,
]
@@ -58,6 +59,7 @@ defmodule Lkn.Core.Puppeteer do
[do: use_block] ->
Specs.gen_server_plugin_entry_point(
use_block,
+ "puppeteer_key",
quote do Lkn.Core.Puppeteer.k end,
&(Lkn.Core.Name.puppeteer(&1)),
[quote do unquote(Specs.var_name("instance_key")) :: Lkn.Core.Instance.k end],
diff --git a/lib/lkn/core/specs.ex b/lib/lkn/core/specs.ex
index fc3be37..3471d4c 100644
--- a/lib/lkn/core/specs.ex
+++ b/lib/lkn/core/specs.ex
@@ -33,7 +33,7 @@ defmodule Lkn.Core.Specs do
end))
end
- def gen_server_plugin_entry_point(block, key_type, key_to_name, additional_args, state_type) do
+ def gen_server_plugin_entry_point(block, key_name, key_type, key_to_name, additional_args, state_type) do
block = case block do
{:__block__, _, x} -> x
x -> [x]
@@ -45,8 +45,8 @@ defmodule Lkn.Core.Specs do
plugin = quote do :plugin end
- casts_client = Enum.map(casts, &(cast_client(plugin, var_name("key"), key_type, key_to_name, &1)))
- casts_behaviour = Enum.map(casts, &(cast_server(&1, var_name("key"), key_type, additional_args, state_type, "_plugin")))
+ casts_client = Enum.map(casts, &(cast_client(plugin, var_name(key_name), key_type, key_to_name, &1)))
+ casts_behaviour = Enum.map(casts, &(cast_server(&1, var_name(key_name), key_type, additional_args, state_type, "_plugin")))
quote do
unquote(casts_client)
diff --git a/test/core_test.exs b/test/core_test.exs
index 6d7accf..5d7d205 100644
--- a/test/core_test.exs
+++ b/test/core_test.exs
@@ -542,7 +542,7 @@ defmodule Test.Puppeteer do
use Test.Puppeteer.Specs do
cast wizz(n :: number) do
for i <- 0..(n-1) do
- send state, {:wizz, i, key}
+ send state, {:wizz, i, puppeteer_key}
end
cast_return()