module ContextFilters::Context::Global

builds list of filters and provides dsl for building nested context and allows evaluating filters on methods in the current context

Public Instance Methods

evaluate_filters(target, method) { || ... } click to toggle source

evaluates all matching filters for given context_stack, allows to do extra work for priority.nil? or on the end of the priorities,

@param method [Proc] the method to evaluate with filters matching current context @yield on first priority.nil? or on the end when none

# File lib/context-filters/context/global.rb, line 24
def evaluate_filters(target, method)
  local_called = false

  priority_filters.each do |priority, filters|

    context_stack.each { |options| filters.apply(target, method, options) }

    if priority.nil? && block_given? && !local_called
      yield
      local_called = true
    end

  end

  yield if block_given? && !local_called
end