module MongoModel::PrettyInspect
Public Instance Methods
inspect()
click to toggle source
Returns the contents of the document as a nicely formatted string.
# File lib/mongomodel/concerns/pretty_inspect.rb, line 18 def inspect "#<#{self.class.name} #{attributes_for_inspect}>" end
Private Instance Methods
attributes_for_inspect()
click to toggle source
# File lib/mongomodel/concerns/pretty_inspect.rb, line 23 def attributes_for_inspect attrs = self.class.model_properties.map { |name, property| "#{name}: #{send(name).inspect}" } attrs.unshift "id: #{id}" if self.class.properties.include?(:id) attrs * ', ' end