Created
November 23, 2021 00:36
-
-
Save ihumanable/f3c42379c70c05cf1cebdcbf30e5a9c1 to your computer and use it in GitHub Desktop.
Patch.Mock.Server delegate/3 simplified
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def delegate(module, name, arguments) do | |
server = Naming.server(module) | |
case GenServer.call(server, {:delegate, name, arguments}) do | |
{:ok, reply} -> | |
reply | |
:error -> | |
original = Naming.original(module) | |
apply(original, name, arguments) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment