Class: Rethinker::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/rethinker/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Connection

Returns a new instance of Connection.



6
7
8
9
# File 'lib/rethinker/connection.rb', line 6

def initialize(uri)
  self.uri = uri
  parse_uri
end

Instance Attribute Details

#database_nameObject

A connection is bound to a specific database.



4
5
6
# File 'lib/rethinker/connection.rb', line 4

def database_name
  @database_name
end

#hostObject

A connection is bound to a specific database.



4
5
6
# File 'lib/rethinker/connection.rb', line 4

def host
  @host
end

#portObject

A connection is bound to a specific database.



4
5
6
# File 'lib/rethinker/connection.rb', line 4

def port
  @port
end

#uriObject

A connection is bound to a specific database.



4
5
6
# File 'lib/rethinker/connection.rb', line 4

def uri
  @uri
end

Instance Method Details

#databaseObject



26
27
28
# File 'lib/rethinker/connection.rb', line 26

def database
  @database ||= Rethinker::Database.new(self)
end

#rawObject Also known as: connect



11
12
13
# File 'lib/rethinker/connection.rb', line 11

def raw
  @raw ||= RethinkDB::Connection.new(:host => host, :port => port, :db => database_name)
end