Sha256: 3bd8e376edaaed459f2df444e958657526807cff8297298b3d350d11ff5e13c8

Contents?: true

Size: 345 Bytes

Versions: 2

Compression:

Stored size: 345 Bytes

Contents

class Array
  def to_mongo_hash
    map { |x| x.safe_to_mongo_hash }
  end
  def to_mongo_object
    map { |x| x.safe_to_mongo_object }
  end
  def to_mongo_ref_hash
    map { |x| x.to_mongo_ref_hash }
  end
  def can_mongo_convert?
    all? { |x| x.can_mongo_convert? && x }
  end
end

class Array
  def sum
    inject { |s,i| s + i }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongo_persist-0.2.1 lib/mongo_persist/array_ext.rb
mongo_persist-0.2.0 lib/mongo_persist/array_ext.rb