class AuditLoggable::ChangeSet::AttributesRedactor

Constants

REDACTED_VALUE

Public Class Methods

new(redacted_attributes, changes) click to toggle source
# File lib/audit_loggable/change_set.rb, line 49
def initialize(redacted_attributes, changes)
  @redacted_attributes = redacted_attributes
  @changes = changes
end

Public Instance Methods

call() click to toggle source
# File lib/audit_loggable/change_set.rb, line 54
def call
  @redacted_attributes.each.with_object(@changes.dup) do |name, changes|
    next unless changes.key?(name)

    changes[name] =
      if changes[name].is_a? ::Array
        ::Array.new(changes[name].size, REDACTED_VALUE)
      else
        REDACTED_VALUE
      end
  end
end