Module: ContextFilters::Context::Global
- Includes:
- GlobalContext, GlobalFilters
- Included in:
- ContextFilters::Context
- Defined in:
- lib/context-filters/context/global.rb
Overview
builds list of filters and provides dsl for building nested context and allows evaluating filters on methods in the current context
Instance Method Summary collapse
-
#evaluate_filters(target, method) { ... } ⇒ Object
evaluates all matching filters for given context_stack, allows to do extra work for
priority.nil?
or on the end of the priorities,.
Methods included from GlobalFilters
#filter, #initialize_priority_filters, #priority_filters
Methods included from GlobalContext
Instance Method Details
#evaluate_filters(target, method) { ... } ⇒ Object
evaluates all matching filters for given context_stack, allows to do extra work for priority.nil?
or on the end of the priorities,
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# 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 { || filters.apply(target, method, ) } if priority.nil? && block_given? && !local_called yield local_called = true end end yield if block_given? && !local_called end |