class Morel::Collection

Constants

OPERATIONS

Attributes

collection[RW]
name[RW]

Public Class Methods

db=(db) click to toggle source
# File lib/morel/collection.rb, line 16
def self.db= db
  @@db = db
end
new(name) click to toggle source
# File lib/morel/collection.rb, line 8
def initialize name
  @name = name
  @collection = db.create_collection(name)
end

Public Instance Methods

db() click to toggle source
# File lib/morel/collection.rb, line 13
def db
  @@db
end
delete() click to toggle source
# File lib/morel/collection.rb, line 20
def delete
  db.drop_collection(name)
end
first() click to toggle source
# File lib/morel/collection.rb, line 24
def first
  find_one
end
sorted_window(size, &block) click to toggle source
# File lib/morel/sorted_window.rb, line 6
def sorted_window size, &block
  SortedWindow.new(:collection => self, :size => size, :block => block)
end