Class: Mongo::Server::Context
- Inherits:
-
Object
- Object
- Mongo::Server::Context
- Extended by:
- Forwardable
- Defined in:
- lib/mongo/server/context.rb
Overview
Represents a context in which messages are sent to the server on a connection.
Instance Attribute Summary collapse
-
#server ⇒ Mongo::Server
readonly
Server The server the context is for.
Instance Method Summary collapse
-
#initialize(server) ⇒ Context
constructor
Instantiate a server context.
-
#with_connection(&block) ⇒ Object
Execute a block of code with a connection, that is checked out of the pool and then checked back in.
Constructor Details
#initialize(server) ⇒ Context
Instantiate a server context.
47 48 49 |
# File 'lib/mongo/server/context.rb', line 47 def initialize(server) @server = server end |
Instance Attribute Details
#server ⇒ Mongo::Server (readonly)
Returns server The server the context is for.
26 27 28 |
# File 'lib/mongo/server/context.rb', line 26 def server @server end |
Instance Method Details
#with_connection(&block) ⇒ Object
Execute a block of code with a connection, that is checked out of the pool and then checked back in.
62 63 64 |
# File 'lib/mongo/server/context.rb', line 62 def with_connection(&block) server.pool.with_connection(&block) end |