Class: ROM::Mongo::Adapter::Dataset
- Inherits:
-
Object
- Object
- ROM::Mongo::Adapter::Dataset
- Defined in:
- lib/rom/mongo/adapter.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #header ⇒ Object
-
#initialize(collection, header) ⇒ Dataset
constructor
A new instance of Dataset.
- #query? ⇒ Boolean
Constructor Details
#initialize(collection, header) ⇒ Dataset
Returns a new instance of Dataset.
20 21 22 23 |
# File 'lib/rom/mongo/adapter.rb', line 20 def initialize(collection, header) super @header = header unless query? end |
Instance Method Details
#each(&block) ⇒ Object
29 30 31 |
# File 'lib/rom/mongo/adapter.rb', line 29 def each(&block) collection.find.each(&block) end |
#header ⇒ Object
25 26 27 |
# File 'lib/rom/mongo/adapter.rb', line 25 def header query? ? query.operation.fields : @header end |
#query? ⇒ Boolean
33 34 35 |
# File 'lib/rom/mongo/adapter.rb', line 33 def query? collection.is_a?(Moped::Query) end |