Sha256: f1a0e491bd287d4284eeed5f282fc414729c90a22444440f2d3e980d47155205

Contents?: true

Size: 516 Bytes

Versions: 4

Compression:

Stored size: 516 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

4 entries across 4 versions & 1 rubygems

Version Path
mongo_mapper-0.16.0 lib/mongo_mapper/extensions/array.rb
mongo_mapper-0.15.6 lib/mongo_mapper/extensions/array.rb
mongo_mapper-0.15.5 lib/mongo_mapper/extensions/array.rb
mongo_mapper-0.15.4 lib/mongo_mapper/extensions/array.rb