instance method compile_filters!

Ruby on Rails 7.2.3

Since v7.1.6 Private

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

compile_filters!(filters)

No documentation comment.

Parameters

filters req
Source
# File activesupport/lib/active_support/parameter_filter.rb, line 93
    def compile_filters!(filters)
      @no_filters = filters.empty?
      return if @no_filters

      @regexps, strings = [], []
      @deep_regexps, deep_strings = nil, nil
      @blocks = nil

      filters.each do |item|
        case item
        when Proc
          (@blocks ||= []) << item
        when Regexp
          if item.to_s.include?("\\.")
            (@deep_regexps ||= []) << item
          else
            @regexps << item
          end
        else
          s = Regexp.escape(item.to_s)
          if s.include?("\\.")
            (deep_strings ||= []) << s
          else
            strings << s
          end
        end
      end

      @regexps << Regexp.new(strings.join("|"), true) unless strings.empty?
      (@deep_regexps ||= []) << Regexp.new(deep_strings.join("|"), true) if deep_strings
    end

Defined in activesupport/lib/active_support/parameter_filter.rb line 93 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::ParameterFilter

Type at least 2 characters to search.

↑↓ navigate · open · esc close