Method: Zafu::Process::Context#with_context

Defined in:
lib/zafu/process/context.rb

#with_context(cont, merge = true) ⇒ Object

Change context for a given scope.



158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/zafu/process/context.rb', line 158

def with_context(cont, merge = true)
  raise "Block missing" unless block_given?
  cont_bak = @context.dup
    if merge
      @context.merge!(cont)
    else
      @context = cont
    end
    res = yield
  @context = cont_bak
  res
end