Skip to content

Instantly share code, notes, and snippets.

@davetron5000
Created May 4, 2012 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davetron5000/2597361 to your computer and use it in GitHub Desktop.
Save davetron5000/2597361 to your computer and use it in GitHub Desktop.
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