Class: Barrister::BatchTransport
- Inherits:
-
Object
- Object
- Barrister::BatchTransport
- Defined in:
- lib/barrister.rb
Overview
Internal transport used by the BatchClient. You shouldn’t create this directly.
Instance Attribute Summary collapse
-
#requests ⇒ Object
Returns the value of attribute requests.
-
#sent ⇒ Object
Returns the value of attribute sent.
Instance Method Summary collapse
-
#initialize(client) ⇒ BatchTransport
constructor
A new instance of BatchTransport.
-
#request(req) ⇒ Object
Request simply stores the req object in an interal Array When send() is called on the BatchClient, these are sent to the server.
Constructor Details
#initialize(client) ⇒ BatchTransport
Returns a new instance of BatchTransport.
437 438 439 440 441 |
# File 'lib/barrister.rb', line 437 def initialize(client) @client = client @requests = [ ] @sent = false end |
Instance Attribute Details
#requests ⇒ Object
Returns the value of attribute requests.
435 436 437 |
# File 'lib/barrister.rb', line 435 def requests @requests end |
#sent ⇒ Object
Returns the value of attribute sent.
435 436 437 |
# File 'lib/barrister.rb', line 435 def sent @sent end |
Instance Method Details
#request(req) ⇒ Object
Request simply stores the req object in an interal Array When send() is called on the BatchClient, these are sent to the server.
445 446 447 448 449 450 451 |
# File 'lib/barrister.rb', line 445 def request(req) if @sent raise "Batch has already been sent!" end @requests << req return nil end |