Sha256: 599f7f2336f0f89709351f46dd2203894c0e73f6336defca2626e5f9d884e48a
Contents?: true
Size: 1004 Bytes
Versions: 1
Compression:
Stored size: 1004 Bytes
Contents
module Kangaroo module Model module Inspector extend ActiveSupport::Concern # @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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kangaroo-0.1.0.alpha1 | lib/kangaroo/model/inspector.rb |