Goodbye, instance_eval on Vagrant::Action::Builder!

This commit is contained in:
Mitchell Hashimoto 2012-07-26 22:00:25 -07:00
parent 2ef20586da
commit 5f8a654393
1 changed files with 3 additions and 9 deletions

View File

@ -9,20 +9,14 @@ module Vagrant
# #
# Building an action sequence is very easy: # Building an action sequence is very easy:
# #
# app = Vagrant::Action::Builder.new do # app = Vagrant::Action::Builder.new.tap do |b|
# use MiddlewareA # b.use MiddlewareA
# use MiddlewareB # b.use MiddlewareB
# end # end
# #
# Vagrant::Action.run(app) # Vagrant::Action.run(app)
# #
class Builder class Builder
# Initializes the builder. An optional block can be passed which
# will be evaluated in the context of the instance.
def initialize(&block)
instance_eval(&block) if block_given?
end
# Returns a mergeable version of the builder. If `use` is called with # Returns a mergeable version of the builder. If `use` is called with
# the return value of this method, then the stack will merge, instead # the return value of this method, then the stack will merge, instead
# of being treated as a separate single middleware. # of being treated as a separate single middleware.