Module: MongoModel::PrettyInspect::ClassMethods

Defined in:
lib/mongomodel/concerns/pretty_inspect.rb

Instance Method Summary collapse

Instance Method Details

#inspectObject

Returns a string like 'Post(title:String, body:String)'



7
8
9
10
11
12
13
14
# File 'lib/mongomodel/concerns/pretty_inspect.rb', line 7

def inspect
  if [Document, EmbeddedDocument].include?(self)
    super
  else
    attr_list = model_properties.map { |name, property| "#{name}: #{property.type.inspect}" } * ', '
    "#{super}(#{attr_list})"
  end
end