Created
May 4, 2012 20:01
-
-
Save davetron5000/2597361 to your computer and use it in GitHub Desktop.
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 Step | |
attr_accessor :result | |
def call(*args) | |
raise "subclass implement" | |
end | |
end | |
class NoOp < Step | |
def iniitalize(result) | |
@result = result | |
end | |
def call(*args) | |
self | |
end | |
end | |
class Step1 < Step | |
def call(*args) | |
if things_are_sweet | |
Step2.new.call | |
else | |
NoOp.new("shit done broke") | |
end | |
end | |
end | |
class Step2 < Step | |
def call(*args) | |
if things_are_amazing | |
self | |
else | |
NoOp.new("very borked") | |
end | |
end | |
end | |
return Step1.new.call(args).result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment