class MongoMapper::Plugins::Associations::Collection

Public Instance Methods

[](val) click to toggle source
# File lib/mongo_mapper/plugins/associations/proxy/collection.rb, line 22
def [](val)
  objs = to_a
  objs ? objs[val] : nil
end
each(&block) click to toggle source
# File lib/mongo_mapper/plugins/associations/proxy/collection.rb, line 18
def each(&block)
  to_a.each(&block)
end
empty?() click to toggle source
# File lib/mongo_mapper/plugins/associations/proxy/collection.rb, line 27
def empty?
  to_a.empty?
end
length() click to toggle source
# File lib/mongo_mapper/plugins/associations/proxy/collection.rb, line 35
def length
  to_a.length
end
read() click to toggle source
# File lib/mongo_mapper/plugins/associations/proxy/collection.rb, line 44
def read
  self
end
reset() click to toggle source
Calls superclass method
# File lib/mongo_mapper/plugins/associations/proxy/collection.rb, line 39
def reset
  super
  target = []
end
size() click to toggle source
# File lib/mongo_mapper/plugins/associations/proxy/collection.rb, line 31
def size
  to_a.size
end
to_a() click to toggle source
# File lib/mongo_mapper/plugins/associations/proxy/collection.rb, line 8
def to_a
  load_target

  target.is_a?(Array) ?
    target :
    Array(target)
end
Also aliased as: to_ary
to_ary()
Alias for: to_a
write(value) click to toggle source
# File lib/mongo_mapper/plugins/associations/proxy/collection.rb, line 48
def write(value)
  replace(value)
  read
end