module Regressor::Controller::Util

Public Instance Methods

after_filters() click to toggle source
# File lib/controller/util.rb, line 9
def after_filters
  filters(:after)
end
around_filters() click to toggle source
# File lib/controller/util.rb, line 13
def around_filters
  filters(:around)
end
before_filters() click to toggle source
# File lib/controller/util.rb, line 5
def before_filters
  filters(:before)
end

Private Instance Methods

filters(kind = nil) click to toggle source
# File lib/controller/util.rb, line 18
def filters(kind = nil)
  controller = @controller.constantize
  all_filters = controller._process_action_callbacks
  all_filters = all_filters.select { |f| f.kind == kind } if kind
  # Reject procs
  all_filters = all_filters.map(&:raw_filter).reject{|filter| filter.class == Proc}
  all_filters.map {|filter| filter.is_a?(Symbol) ? ":#{filter}" : filter.to_s}
end