Class: Mongoid::Report::Output
- Inherits:
-
Object
- Object
- Mongoid::Report::Output
- Defined in:
- lib/mongoid/report/output.rb
Instance Attribute Summary collapse
-
#collection_name ⇒ Object
Returns the value of attribute collection_name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
Instance Attribute Details
#collection_name ⇒ Object
Returns the value of attribute collection_name.
5 6 7 |
# File 'lib/mongoid/report/output.rb', line 5 def collection_name @collection_name end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/mongoid/report/output.rb', line 5 def @options end |
Instance Method Details
#do(rows) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/mongoid/report/output.rb', line 7 def do(rows) drop() return if rows.empty? collection.insert(rows) end |
#drop ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/mongoid/report/output.rb', line 19 def drop return collection.drop() unless [:drop].present? # We will use custom way for dropping the collection or removing the # records partially collection.find([:drop]).remove_all() end |
#present? ⇒ Boolean
15 16 17 |
# File 'lib/mongoid/report/output.rb', line 15 def present? collection_name.present? end |