Module: NCore::FilterAttributes

Extended by:
ActiveSupport::Concern
Defined in:
lib/ncore/filter_attributes.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#inspectObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ncore/filter_attributes.rb', line 27

def inspect
  base = "#{self.class}:0x#{'%016x'%self.object_id} id: #{id.inspect}"
  inspect_chain = Thread.current[:inspect_chain] ||= []
  return "#<#{base}, ...>" if inspect_chain.include? self
  begin
    inspect_chain.push self
    attribs = @attribs.except(:id).each.with_object({}) do |(k,v),h|
      h[k] = v.nil? ? nil : self.class.inspection_filter.filter_param(k,v)
    end
    "#<#{base}, attribs: #{attribs.inspect}, metadata: #{.inspect}>"
  ensure
    inspect_chain.pop
  end
end