Sha256: b7b9b0d8cfa1353a41170a3717411a9cac4bd900e4b82ce5b4eaf29b504059bb

Contents?: true

Size: 515 Bytes

Versions: 6

Compression:

Stored size: 515 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Extensions
    module Array
      extend ActiveSupport::Concern

      module ClassMethods
        def to_mongo(value)
          value = value.respond_to?(:lines) ? value.lines : value
          value.to_a
        end

        def from_mongo(value)
          value || []
        end
      end

      def _mongo_mapper_deep_copy_
        map { |value| value._mongo_mapper_deep_copy_ }
      end
    end
  end
end

class Array
  include MongoMapper::Extensions::Array
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongo_mapper-0.15.3 lib/mongo_mapper/extensions/array.rb
mongo_mapper-0.15.2 lib/mongo_mapper/extensions/array.rb
mongo_mapper-0.15.1 lib/mongo_mapper/extensions/array.rb
mongo_mapper-0.15.0 lib/mongo_mapper/extensions/array.rb
mongo_mapper-0.14.0 lib/mongo_mapper/extensions/array.rb
mongo_mapper-0.14.0.rc1 lib/mongo_mapper/extensions/array.rb