lib/mongo_mapper/plugins/inspect.rb in mongo_mapper-0.9.1 vs lib/mongo_mapper/plugins/inspect.rb in mongo_mapper-0.9.2
- old
+ new
@@ -3,11 +3,12 @@
module Plugins
module Inspect
extend ActiveSupport::Concern
module InstanceMethods
- def inspect
- attributes_as_nice_string = key_names.sort.collect do |name|
+ def inspect(include_nil = false)
+ keys = include_nil ? key_names : attributes.keys
+ attributes_as_nice_string = keys.sort.collect do |name|
"#{name}: #{self[name].inspect}"
end.join(", ")
"#<#{self.class} #{attributes_as_nice_string}>"
end
end
\ No newline at end of file