Skip to content

Instantly share code, notes, and snippets.

@Sean-Bradley
Created April 14, 2019 12:59
Show Gist options
  • Save Sean-Bradley/ffe5d07b4a84811668f7b3e45c634dab to your computer and use it in GitHub Desktop.
Save Sean-Bradley/ffe5d07b4a84811668f7b3e45c634dab to your computer and use it in GitHub Desktop.
def __init__(self):
# initialize the successor chain
self.chain1 = Dispenser50()
self.chain2 = Dispenser20()
self.chain3 = Dispenser10()
# set the chain of responsibility
# The Client may compose chains once or
# the hadler can set them dynamically at
# handle time
self.chain1.set_successor(self.chain2)
self.chain2.set_successor(self.chain3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment