module Excom::Plugins::Context

Attributes

local_context[RW]

Public Instance Methods

context() click to toggle source
# File lib/excom/plugins/context.rb, line 8
def context
  global_context = ::Excom.context
  return global_context if local_context.nil?

  global_context.respond_to?(:merge) ?
    (global_context.merge(local_context) rescue local_context) :
    local_context
end
execute(*) click to toggle source
Calls superclass method
# File lib/excom/plugins/context.rb, line 24
def execute(*)
  Excom.with_context(context) do
    super
  end
end
with_context(ctx) click to toggle source
# File lib/excom/plugins/context.rb, line 17
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