module Zen::Service::Plugins::Context::ServiceMethods

Public Instance Methods

context() click to toggle source
# File lib/zen/service/plugins/context.rb, line 45
def context
  Thread.current[:zen_service_context]
end
with_context(ctx) { || ... } click to toggle source
# 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