Sha256: 3c3afa52241827066abbe4e5469fc84b4c3829ac5241957a75f085063e3b38a8

Contents?: true

Size: 472 Bytes

Versions: 3

Compression:

Stored size: 472 Bytes

Contents

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongo_mapper-0.10.1 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.10.0 lib/mongo_mapper/plugins/inspect.rb
mongo_mapper-0.9.2 lib/mongo_mapper/plugins/inspect.rb