Sha256: 33994d9e56aee9b1303e2a73188e0d90cd4f7c9374d0705f11d47495bbd9566a
Contents?: true
Size: 617 Bytes
Versions: 34
Compression:
Stored size: 617 Bytes
Contents
module CassandraObject module Inspect def inspect inspection = ["#{self.class.primary_key}: #{id.inspect}"] @attributes.keys.each do |attribute| inspection << "#{attribute}: #{attribute_for_inspect(attribute)}" end "#<#{self.class} #{inspection * ', '}>" end def attribute_for_inspect(attr_name) value = read_attribute(attr_name) 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
34 entries across 34 versions & 1 rubygems