Method: Dupe::Database::Record#record_inspect

Defined in:
lib/superdupe/record.rb

#record_inspectObject Also known as: inspect



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/superdupe/record.rb', line 23

def record_inspect
  # if a namespace is available, the titleize method destroy the scope operator
  if class_name = __model__ 
    __model__name.to_s.include?('::') ? "Duped::#{__model__.name.to_s}" : "Duped::#{__model__.name.to_s.titleize}"
  else
    self.class.to_s
  end
  
  "<##{class_name}".tap do |inspection|
    keys.each do |key|
      inspection << " #{key}=#{self[key].inspect}"
    end
    inspection << ">"
  end
end