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.
444 445 446 447 448 |
# File 'lib/barrister.rb', line 444 def initialize(client) @client = client @requests = [ ] @sent = false end |
Instance Attribute Details
#requests ⇒ Object
Returns the value of attribute requests.
442 443 444 |
# File 'lib/barrister.rb', line 442 def requests @requests end |
#sent ⇒ Object
Returns the value of attribute sent.
442 443 444 |
# File 'lib/barrister.rb', line 442 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.
452 453 454 455 456 457 458 |
# File 'lib/barrister.rb', line 452 def request(req) if @sent raise "Batch has already been sent!" end @requests << req return nil end |