module Zen::Service::Plugins::Context

Attributes

local_context[RW]

Public Instance Methods

context() click to toggle source
# File lib/zen/service/plugins/context.rb, line 11
def context
  global_context = ::Zen::Service.context
  return global_context if local_context.nil?

  if global_context.respond_to?(:merge)
    global_context.merge(local_context)
  else
    local_context
  end
end
execute(*) click to toggle source
Calls superclass method
# File lib/zen/service/plugins/context.rb, line 29
def execute(*)
  ::Zen::Service.with_context(context) do
    super
  end
end
with_context(ctx) click to toggle source
# File lib/zen/service/plugins/context.rb, line 22
def with_context(ctx)
  clone.tap do |copy|
    copy.local_context =
      copy.local_context.respond_to?(:merge) ? copy.local_context.merge(ctx) : ctx
  end
end