Class: EventMachine::RTMP::PendingRequest
- Inherits:
-
Object
- Object
- EventMachine::RTMP::PendingRequest
- Defined in:
- lib/em-rtmp/pending_request.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#request ⇒ Object
Returns the value of attribute request.
Class Method Summary collapse
-
.create(request, connection) ⇒ Object
Create a request and add it to the pending requests hash.
-
.find(message_type, transaction_id, connection) ⇒ Object
Find a request by message type and transaction id.
Instance Method Summary collapse
-
#delete ⇒ Object
Delete the current request from the list of pending requests.
-
#initialize(request, connection) ⇒ PendingRequest
constructor
Create a new pending request from a request.
Constructor Details
#initialize(request, connection) ⇒ PendingRequest
Create a new pending request from a request
Returns nothing
9 10 11 12 |
# File 'lib/em-rtmp/pending_request.rb', line 9 def initialize(request, connection) self.request = request self.connection = connection end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
4 5 6 |
# File 'lib/em-rtmp/pending_request.rb', line 4 def connection @connection end |
#request ⇒ Object
Returns the value of attribute request.
4 5 6 |
# File 'lib/em-rtmp/pending_request.rb', line 4 def request @request end |
Class Method Details
.create(request, connection) ⇒ Object
Create a request and add it to the pending requests hash
request - Request to add
Returns the request
38 39 40 41 42 43 44 |
# File 'lib/em-rtmp/pending_request.rb', line 38 def self.create(request, connection) = request.header. transaction_id = request..transaction_id.to_i connection.pending_requests[] ||= {} connection.pending_requests[][transaction_id] = new(request, connection) connection.pending_requests[][transaction_id] end |
.find(message_type, transaction_id, connection) ⇒ Object
Find a request by message type and transaction id
message_type - Symbol representing the message type (from header) transaction_id - Integer representing the transaction id
Returns the request or nothing
27 28 29 30 31 |
# File 'lib/em-rtmp/pending_request.rb', line 27 def self.find(, transaction_id, connection) if connection.pending_requests[] connection.pending_requests[][transaction_id.to_i] end end |
Instance Method Details
#delete ⇒ Object
Delete the current request from the list of pending requests
Returns nothing
17 18 19 |
# File 'lib/em-rtmp/pending_request.rb', line 17 def delete connection.pending_requests[request.header.].delete(request..transaction_id.to_i) end |