Module: Excom::Plugins::Context
- Defined in:
- lib/excom/plugins/context.rb
Defined Under Namespace
Modules: ExcomMethods
Instance Attribute Summary collapse
-
#local_context ⇒ Object
readonly
Returns the value of attribute local_context.
Instance Method Summary collapse
Instance Attribute Details
#local_context ⇒ Object
Returns the value of attribute local_context.
5 6 7 |
# File 'lib/excom/plugins/context.rb', line 5 def local_context @local_context end |
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 |
#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 |