Module: Toy::Inspect

Extended by:
ActiveSupport::Concern
Included in:
Object
Defined in:
lib/toy/inspect.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#inspectObject



16
17
18
19
20
21
22
# File 'lib/toy/inspect.rb', line 16

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