Module: Funes::Inspection::ClassMethods

Defined in:
lib/funes/inspection.rb

Instance Method Summary collapse

Instance Method Details

#filter_attributesObject

Returns an array of attribute names whose values should be masked in the output of inspect.



54
55
56
57
58
59
60
61
62
# File 'lib/funes/inspection.rb', line 54

def filter_attributes
  if defined?(@filter_attributes)
    @filter_attributes
  elsif superclass.respond_to?(:filter_attributes)
    superclass.filter_attributes
  else
    []
  end
end

#filter_attributes=(attributes) ⇒ Object

Specifies attributes whose values should be masked in the output of inspect.



66
67
68
69
# File 'lib/funes/inspection.rb', line 66

def filter_attributes=(attributes)
  @inspection_filter = nil
  @filter_attributes = attributes
end

#inspection_filterObject

:nodoc:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/funes/inspection.rb', line 71

def inspection_filter # :nodoc:
  if defined?(@filter_attributes) && @filter_attributes
    @inspection_filter ||= begin
      mask = InspectionMask.new(ActiveSupport::ParameterFilter::FILTERED)
      ActiveSupport::ParameterFilter.new(@filter_attributes, mask: mask)
    end
  elsif superclass.respond_to?(:inspection_filter)
    superclass.inspection_filter
  else
    @inspection_filter ||= begin
      mask = InspectionMask.new(ActiveSupport::ParameterFilter::FILTERED)
      ActiveSupport::ParameterFilter.new([], mask: mask)
    end
  end
end