Module: Zen::Service::Plugins::Context::ServiceMethods

Defined in:
lib/zen/service/plugins/context.rb

Instance Method Summary collapse

Instance Method Details

#contextObject



45
46
47
# File 'lib/zen/service/plugins/context.rb', line 45

def context
  Thread.current[:zen_service_context]
end

#with_context(ctx) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/zen/service/plugins/context.rb', line 36

def with_context(ctx)
  current = context
  Thread.current[:zen_service_context] = context.respond_to?(:merge) ? context.merge(ctx) : ctx

  yield
ensure
  Thread.current[:zen_service_context] = current
end