Sha256: aac4f2d4dbe456de424d24843c40693b8ef9538cd4a7044f5bbbdcb528cc1b19
Contents?: true
Size: 607 Bytes
Versions: 2
Compression:
Stored size: 607 Bytes
Contents
module Toy module Inspect extend ActiveSupport::Concern module ClassMethods def inspect keys = attributes.keys nice_string = keys.sort.map do |name| type = attributes[name].type "#{name}:#{type}" end.join(" ") "#{name}(#{nice_string})" end end def inspect keys = self.class.attributes.keys attributes_as_nice_string = keys.map(&:to_s).sort.map do |name| "#{name}: #{read_attribute(name).inspect}" end "#<#{self.class}:#{object_id} #{attributes_as_nice_string.join(', ')}>" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
toystore-0.13.2 | lib/toy/inspect.rb |
toystore-0.13.1 | lib/toy/inspect.rb |