Module: MongoMapper::Plugins::Inspect

Extended by:
ActiveSupport::Concern
Included in:
Document, EmbeddedDocument
Defined in:
lib/mongo_mapper/plugins/inspect.rb

Instance Method Summary collapse

Instance Method Details

#inspect(include_nil = false) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/mongo_mapper/plugins/inspect.rb', line 7

def inspect(include_nil = false)
  keys = include_nil ? key_names : attributes.keys
  attributes_as_nice_string = keys.sort.collect do |name|
    "#{name}: #{self.send(:"#{name}").inspect}"
  end.join(", ")
  "#<#{self.class} #{attributes_as_nice_string}>"
end