Class: ROM::RethinkDB::Dataset

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/rethinkdb/dataset.rb

Overview

Dataset for RethinkDB

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, rql, connection) ⇒ Dataset

Returns a new instance of Dataset.



9
10
11
12
13
# File 'lib/rom/rethinkdb/dataset.rb', line 9

def initialize(scope, rql, connection)
  @scope = scope
  @rql = rql
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)



7
8
9
# File 'lib/rom/rethinkdb/dataset.rb', line 7

def connection
  @connection
end

#rqlObject (readonly)



7
8
9
# File 'lib/rom/rethinkdb/dataset.rb', line 7

def rql
  @rql
end

#scopeObject (readonly)



7
8
9
# File 'lib/rom/rethinkdb/dataset.rb', line 7

def scope
  @scope
end

Instance Method Details

#countObject



23
24
25
# File 'lib/rom/rethinkdb/dataset.rb', line 23

def count
  scope.count.run(connection)
end

#each(&block) ⇒ Object



19
20
21
# File 'lib/rom/rethinkdb/dataset.rb', line 19

def each(&block)
  to_a.each(&block)
end

#to_aObject



15
16
17
# File 'lib/rom/rethinkdb/dataset.rb', line 15

def to_a
  scope.run(connection)
end