Created
November 23, 2021 00:38
-
-
Save ihumanable/e92ad12bfeb71788a5c2a7bcc7e294cd to your computer and use it in GitHub Desktop.
Patch Call Graph
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
assert {:bad, :error} == Discord.send_message(%Message{}) | |
# We start at the Facade | |
Discord.send_message(%Message{}) { | |
# The Facade calls the Delegate | |
Delegate.send_message(message) { | |
# The Delegate checks if the Server has a patch for send_message/1 | |
Server.delegate(Discord, :send_message, [message]) { | |
# The Server doesn't, so it calls the Original | |
Original.send_message(message) { | |
# The Original calls the Delegate's validate_message/1 function | |
Delegate.validate_message(message) { | |
# The Delegate checks if the Server has a patch for validate_message/1 | |
Server.delegate(Discord, :validate_message, [message]) { | |
# The Server does have a patch for validate_message/1 so it returns it | |
} -> {:bad, :error} | |
# The Delegate returns the patched value to the Original | |
} -> {:bad, :error} | |
# The Original's with statement fails to match, so it returns the value | |
} -> {:bad, :error} | |
# The Server returns the Original's result | |
} -> {:bad, :error} | |
# The Delegate returns the Server's result | |
} -> {:bad, :error} | |
# The Facade returns the Delete's result | |
} -> {:bad, :error} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment