lib/eco/api/session/config/workflow.rb in eco-helpers-2.5.10 vs lib/eco/api/session/config/workflow.rb in eco-helpers-2.6.0

- old
+ new

@@ -85,18 +85,19 @@ # - if `key` is not provided, it targets the _current stage_ # - if `key` is provided, it targets the specific _sub-stage_ # @yield [stage_workflow] further _workflow_ configuration `for` the target stage `key` # @yieldparam stage_workflow [Eco::API::Session::Config::Workflow] the _target stage_ referred by `key` # @return [Eco::API::Session::Config::Workflow] the current stage object (to ease chainig). - def for(key = nil) + def for(key = nil, &block) raise "A block should be given." unless block_given? if !key yield(self) else - stage(key).for(&Proc.new) + stage(key).for(&block) end self end + alias_method :open, :for # Used in **configuration** time **to define** the **behaviour** the target (sub)stage `key` # @note if a `block` is provided it will **not** `yield` the target stage immediately, but when the _workflow_ reaches the stage # @param key [Symbol, nil] cases: # - if `key` is not provided, it targets the _current stage_