module ContextFilters::Context::GlobalContext

temporarily stack context and yield code

Public Instance Methods

context(options) { |self| ... } click to toggle source

starts new context @param options [Object] options to start new context @param block [Proc] code block that will enable filtering for the given options @yield a block in which context_stack temporarily includes filter_block @yieldparam [self] use it optionally to give a new name to the

code evaluated in new context
# File lib/context-filters/context/global_context.rb, line 26
def context(options, &block)
  context_stack.push(options)
  yield(self)
ensure
  context_stack.pop
end
context_stack() click to toggle source

@return [Array] the context stack @api private

# File lib/context-filters/context/global_context.rb, line 16
def context_stack
  @context_stack ||= [nil]
end