Sha256: 968333e31a2b36aeaa8056fde87312a9cb267f9c6e56b215cd35cdc07fd39086

Contents?: true

Size: 430 Bytes

Versions: 18

Compression:

Stored size: 430 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Plugins
    module Inspect
      extend ActiveSupport::Concern

      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
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
mongo_mapper-0.15.6 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.15.5 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.15.4 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.15.3 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.15.2 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.15.1 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.15.0 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.14.0 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.14.0.rc1 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.13.1 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.13.0 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.13.0.beta2 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.13.0.beta1 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.12.0 lib/mongo_mapper/plugins/inspect.rb
lookout-mongo_mapper-0.11.3 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.11.2 lib/mongo_mapper/plugins/inspect.rb
jamieorc-mongo_mapper-0.11.1.1 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.11.1 lib/mongo_mapper/plugins/inspect.rb