diff --git a/lib/display.ex b/lib/display.ex index 8ed02b9..1e25203 100644 --- a/lib/display.ex +++ b/lib/display.ex @@ -39,6 +39,6 @@ defmodule Display do end defp display_koan(name) do - String.replace(to_string(name), "koan: ", "") + String.replace(to_string(name), Koans.prefix, "") end end diff --git a/lib/koans.ex b/lib/koans.ex index 98dcee0..dad845a 100644 --- a/lib/koans.ex +++ b/lib/koans.ex @@ -1,6 +1,8 @@ defmodule Koans do + @prefix "koan: " + defmacro koan(name, body) do - compiled_name = :"koan: #{name}" + compiled_name = :"#{prefix}#{name}" quote do def unquote(compiled_name)() do try do @@ -19,4 +21,8 @@ defmodule Koans do import ExUnit.Assertions end end + + def prefix do + @prefix + end end diff --git a/lib/runner.ex b/lib/runner.ex index 4f9d8fe..bf18902 100644 --- a/lib/runner.ex +++ b/lib/runner.ex @@ -50,6 +50,6 @@ defmodule Runner do end defp koan?(fun_name) do - String.starts_with?(to_string(fun_name), "koan: ") + String.starts_with?(to_string(fun_name), Koans.prefix) end end