Module: ContextFilters::Context::GlobalContext
- Included in:
- Global
- Defined in:
- lib/context-filters/context/global_context.rb
Overview
temporarily stack context and yield code
Instance Method Summary collapse
-
#context(options, &block) {|use| ... } ⇒ Object
starts new context.
-
#context_stack ⇒ Array
private
The context stack.
Instance Method Details
#context(options, &block) {|use| ... } ⇒ Object
starts new context
26 27 28 29 30 31 |
# File 'lib/context-filters/context/global_context.rb', line 26 def context(, &block) context_stack.push() yield(self) ensure context_stack.pop end |
#context_stack ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the context stack.
16 17 18 |
# File 'lib/context-filters/context/global_context.rb', line 16 def context_stack @context_stack ||= [nil] end |