Sha256: c029bf89bb141a531144e24861c93455f8ee5c8c9da19a58ec656227a3cfc4de
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
module Kangaroo module Model module Inspector # @private def self.included klass klass.extend ClassMethods end # @private def inspect inspect_wrap do |str| str << [inspect_id, *inspect_attributes].join(', ') end end private def inspect_id "id: #{id.inspect}" end def inspect_attributes attributes.to_a.map do |key_val| name, value = key_val [name, value.inspect].join ": " end end def inspect_wrap "".tap do |str| str << "<#{self.class.name} " yield str str << ">" end end # @private module ClassMethods def inspect inspect_wrap do |str| str << ['id', *attribute_names].join(', ') end end private def inspect_wrap "".tap do |str| str << "<#{name} " yield str str << ">" end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems