class ActionTracer::Filters
Public Class Methods
build(controller)
click to toggle source
# File lib/action_tracer/filters.rb, line 54 def self.build(controller) filters = { before: [], after: [], around: [] } raw_filters = controller.__callbacks[:process_action].send(:chain).group_by(&:kind) raw_filters.each do |kind, filter| filters[kind] = filter.map(&:raw_filter).map do |f| Filter.new(f, method: f.is_a?(Symbol) ? controller.method(f) : f) end end new(filters[:before], filters[:after], filters[:around], action: Action.build(controller)) end
new(before = [], after = [], around = [], action:)
click to toggle source
# File lib/action_tracer/filters.rb, line 47 def initialize(before = [], after = [], around = [], action:) @before = before @after = after @around = around @action = action end
Public Instance Methods
print()
click to toggle source
# File lib/action_tracer/filters.rb, line 65 def print invoked_before.map(&:to_a).each { |filter| ActionTracer.logger.info filter } ActionTracer.logger.info @action.to_a invoked_after.map(&:to_a).reverse_each { |filter| ActionTracer.logger.info filter } end
Private Instance Methods
invoked_after()
click to toggle source
# File lib/action_tracer/filters.rb, line 77 def invoked_after @after + @around end
invoked_before()
click to toggle source
# File lib/action_tracer/filters.rb, line 73 def invoked_before @before + @around end