Module: Toy::Inspect
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#inspect ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/toy/inspect.rb', line 16 def inspect keys = self.class.attributes.keys - ['id'] attributes_as_nice_string = keys.map(&:to_s).sort.map do |name| "#{name}: #{read_attribute(name).inspect}" end attributes_as_nice_string.unshift("id: #{read_attribute(:id).inspect}") "#<#{self.class}:#{object_id} #{attributes_as_nice_string.join(', ')}>" end |