Module: Excom::Plugins::Context
- Defined in:
- lib/excom/plugins/context.rb
Defined Under Namespace
Modules: ExcomMethods
Instance Method Summary collapse
Instance Method Details
#context ⇒ Object
8 9 10 11 12 13 14 15 |
# 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 ⇒ Object
24 25 26 27 28 |
# File 'lib/excom/plugins/context.rb', line 24 def execute(*) Excom.with_context(context) do super end end |
#with_context(ctx) ⇒ Object
17 18 19 20 21 22 |
# 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 |