Module: Mongoid::Inspectable

Included in:
Composable
Defined in:
build/mongoid-master/lib/mongoid/inspectable.rb

Overview

Contains the behavior around inspecting documents via inspect.

Instance Method Summary collapse

Instance Method Details

#inspectString

Returns the class name plus its attributes. If using dynamic fields will include those as well.

Examples:

Inspect the document.

person.inspect

Returns:

  • (String)

    A nice pretty string to look at.



15
16
17
18
19
# File 'build/mongoid-master/lib/mongoid/inspectable.rb', line 15

def inspect
  inspection = []
  inspection.concat(inspect_fields).concat(inspect_dynamic_fields)
  "#<#{self.class.name} _id: #{_id}, #{inspection * ', '}>"
end