Sha256: e0222ca5de0aa451773679825aba71592e6920e5a6257b6a8b53510639a77429
Contents?: true
Size: 605 Bytes
Versions: 31
Compression:
Stored size: 605 Bytes
Contents
module Superstore module Inspect def inspect inspection = ["#{self.class.primary_key}: #{id.inspect}"] @attributes.each do |attribute, value| if value.present? inspection << "#{attribute}: #{attribute_for_inspect(value)}" end end "#<#{self.class} #{inspection * ', '}>" end def attribute_for_inspect(value) if value.is_a?(String) && value.length > 50 "#{value[0..50]}...".inspect elsif value.is_a?(Date) || value.is_a?(Time) %("#{value.to_s(:db)}") else value.inspect end end end end
Version data entries
31 entries across 31 versions & 1 rubygems