Module: Auth::Sanitizer::FilteredAttributes::ClassMethods

Defined in:
lib/auth/sanitizer/filtered_attributes.rb

Overview

Class-level helpers for configuring filtered attributes.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.filtered_attribute_names(base) ⇒ Array<Symbol>

The configured attribute names to filter.

Parameters:

  • base (Class) —

    The class to get filtered attributes for

Returns:

  • (Array<Symbol>)


59
60
61
62
63
# File 'lib/auth/sanitizer/filtered_attributes.rb', line 59

def filtered_attribute_names(base)
  return [] unless base.instance_variable_defined?(:@filtered_attribute_names)

  base.instance_variable_get(:@filtered_attribute_names) || []
end

.filtered_attributes(base, *attributes) ⇒ void

This method returns an undefined value.

Declare attributes that should be redacted in inspect output.

Parameters:

  • base (Class) —

    The class the attributes are declared on

  • attributes (Array<Symbol, String>) —

    One or more attribute names



51
52
53
# File 'lib/auth/sanitizer/filtered_attributes.rb', line 51

def filtered_attributes(base, *attributes)
  base.instance_variable_set(:@filtered_attribute_names, attributes.map(&:to_sym))
end

Instance Method Details

#filtered_attribute_names ⇒ Array<Symbol>

The configured attribute names to filter.

Returns:

  • (Array<Symbol>)


77
78
79
# File 'lib/auth/sanitizer/filtered_attributes.rb', line 77

def filtered_attribute_names
  ClassMethods.filtered_attribute_names(self)
end

#filtered_attributes(*attributes) ⇒ void

This method returns an undefined value.

Declare attributes that should be redacted in inspect output.

Parameters:

  • attributes (Array<Symbol, String>) —

    One or more attribute names



70
71
72
# File 'lib/auth/sanitizer/filtered_attributes.rb', line 70

def filtered_attributes(*attributes)
  ClassMethods.filtered_attributes(self, *attributes)
end