Class: OnStomp::Components::Scopes::ReceiptScope
- Inherits:
-
Object
- Object
- OnStomp::Components::Scopes::ReceiptScope
- Includes:
- Interfaces::FrameMethods
- Defined in:
- lib/onstomp/components/scopes/receipt_scope.rb
Overview
Adds a receipt callback to all receipt-able frames generated on this scope
Instance Attribute Summary collapse
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
-
#initialize(callback, client) ⇒ ReceiptScope
constructor
A new instance of ReceiptScope.
-
#transmit(frame, cbs = {}) ⇒ OnStomp::Components::Frame
Wraps OnStomp::Client#transmit, applying the #callback as a receipt handler for all frames before they are sent to the broker.
Methods included from Interfaces::FrameMethods
#abort, #ack, #beat, #begin, #commit, #disconnect, #nack, #send, #subscribe, #unsubscribe
Constructor Details
#initialize(callback, client) ⇒ ReceiptScope
Returns a new instance of ReceiptScope.
9 10 11 12 13 |
# File 'lib/onstomp/components/scopes/receipt_scope.rb', line 9 def initialize callback, client @callback = callback @client = client @connectio = client.connection end |
Instance Attribute Details
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
7 8 9 |
# File 'lib/onstomp/components/scopes/receipt_scope.rb', line 7 def callback @callback end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/onstomp/components/scopes/receipt_scope.rb', line 7 def client @client end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
7 8 9 |
# File 'lib/onstomp/components/scopes/receipt_scope.rb', line 7 def connection @connection end |
Instance Method Details
#transmit(frame, cbs = {}) ⇒ OnStomp::Components::Frame
Wraps OnStomp::Client#transmit, applying the #callback as a receipt handler for all frames before they are sent to the broker.
21 22 23 24 |
# File 'lib/onstomp/components/scopes/receipt_scope.rb', line 21 def transmit frame, cbs={} cbs[:receipt] ||= callback client.transmit frame, cbs end |