Skip to content

Instantly share code, notes, and snippets.

@tenderlove tenderlove/argh.rb Secret
Created Oct 19, 2016

Embed
What would you like to do?
module ExecutionMethods
def curry_one x
curry[x].extend ExecutionMethods
end
alias :to :curry_one
alias :on_event :curry_one
alias :on :curry_one
end
class Execution < Proc
include ExecutionMethods
end
class Expectation < Proc
alias :to :call
end
def expect object
Expectation.new do |exec|
exec.call object
end
end
def transition_from from
Execution.new do |to, event, on, thing|
p [from, to, event, on, thing]
end
end
multiple = Object.new
expect(multiple).to transition_from(:standing).to(:walking).on_event(:walk).on(:move)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.