Module: Excom::Plugins::Context::ExcomMethods

Included in:
Excom
Defined in:
lib/excom/plugins/context.rb

Instance Method Summary collapse

Instance Method Details

#contextObject



39
40
41
# File 'lib/excom/plugins/context.rb', line 39

def context
  Thread.current[:excom_context]
end

#with_context(ctx) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/excom/plugins/context.rb', line 31

def with_context(ctx)
  current, Thread.current[:excom_context] = \
    context, context.respond_to?(:merge) ? context.merge(ctx) : ctx
  yield
ensure
  Thread.current[:excom_context] = current
end