class Readme::Filter
Public Class Methods
for(reject: nil, allow_only: nil)
click to toggle source
# File lib/readme/filter.rb, line 3 def self.for(reject: nil, allow_only: nil) if !reject.nil? && !allow_only.nil? raise FilterArgsError elsif !reject.nil? RejectParams.new(reject) elsif !allow_only.nil? AllowOnly.new(allow_only) else None.new end end
redact(rejected_params)
click to toggle source
# File lib/readme/filter.rb, line 15 def self.redact(rejected_params) rejected_params.each_with_object({}) do |(k, v), hash| # If it's a string then return the length of the redacted field hash[k.to_str] = "[REDACTED#{v.is_a?(String) ? " #{v.length}" : ""}]" end end