class Mongoid::Report::Output

Attributes

collection_name[RW]
options[RW]

Public Instance Methods

do(rows) click to toggle source
# File lib/mongoid/report/output.rb, line 7
def do(rows)
  drop()

  return if rows.empty?

  collection.insert(rows)
end
drop() click to toggle source
# File lib/mongoid/report/output.rb, line 19
def drop
  return collection.drop() unless options[:drop].present?

  # We will use custom way for dropping the collection or removing the
  # records partially
  collection.find(options[:drop]).remove_all()
end
present?() click to toggle source
# File lib/mongoid/report/output.rb, line 15
def present?
  collection_name.present?
end

Private Instance Methods

collection() click to toggle source
# File lib/mongoid/report/output.rb, line 29
def collection
  @collection ||= Collections.get(collection_name)
end