Created
March 5, 2019 00:22
-
-
Save ocrampete16/00e6c0d385bcec6d62e0fb60caff0d9f to your computer and use it in GitHub Desktop.
A Python implementation of the Pipeline pattern
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
class Pipeline: | |
def __init__(self, value): | |
self.value = value | |
self.pipes = [] | |
def through(self, pipe): | |
self.pipes.append(pipe) | |
def now(self): | |
for pipe in self.pipes: | |
self.value = pipe(self.value) | |
return self.value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment