Class: Rethinker::Connection
- Inherits:
-
Object
- Object
- Rethinker::Connection
- Defined in:
- lib/rethinker/connection.rb
Instance Attribute Summary collapse
-
#database_name ⇒ Object
A connection is bound to a specific database.
-
#host ⇒ Object
A connection is bound to a specific database.
-
#port ⇒ Object
A connection is bound to a specific database.
-
#uri ⇒ Object
A connection is bound to a specific database.
Instance Method Summary collapse
- #database ⇒ Object
-
#initialize(uri) ⇒ Connection
constructor
A new instance of Connection.
- #raw ⇒ Object (also: #connect)
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_name ⇒ Object
A connection is bound to a specific database.
4 5 6 |
# File 'lib/rethinker/connection.rb', line 4 def database_name @database_name end |
#host ⇒ Object
A connection is bound to a specific database.
4 5 6 |
# File 'lib/rethinker/connection.rb', line 4 def host @host end |
#port ⇒ Object
A connection is bound to a specific database.
4 5 6 |
# File 'lib/rethinker/connection.rb', line 4 def port @port end |
#uri ⇒ Object
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
#database ⇒ Object
26 27 28 |
# File 'lib/rethinker/connection.rb', line 26 def database @database ||= Rethinker::Database.new(self) end |
#raw ⇒ Object 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 |