Module: OnStomp::Components::Scopes
- Included in:
- OnStomp::Client
- Defined in:
- lib/onstomp/components/scopes.rb
Overview
Mixin for clients to create frame scopes.
Defined Under Namespace
Classes: HeaderScope, ReceiptScope, TransactionScope
Instance Method Summary (collapse)
-
- (OnStomp::Components::Scopes::TransactionScope) transaction(tx_id = nil) {|t| ... }
Creates a new TransactionScope and evaluates the block within that scope if one is given.
-
- (OnStomp::Components::Scopes::HeaderScope) with_headers(headers) {|h| ... }
Creates a new HeaderScope that will apply the provided headers to all frames generated on the scope.
-
- (OnStomp::Components::Scopes::ReceiptScope) with_receipt {|r| ... }
Creates a new ReceiptScope.
Instance Method Details
- (OnStomp::Components::Scopes::TransactionScope) transaction(tx_id = nil) {|t| ... }
Creates a new TransactionScope and evaluates the block within that scope if one is given.
22 23 24 25 26 |
# File 'lib/onstomp/components/scopes.rb', line 22 def transaction tx_id=nil, &block OnStomp::Components::Scopes::TransactionScope.new(tx_id, self).tap do |t| t.perform(&block) if block end end |
- (OnStomp::Components::Scopes::HeaderScope) with_headers(headers) {|h| ... }
Creates a new HeaderScope that will apply the provided headers to all frames generated on the scope. If a block is given, it will be evaluated within this scope.
36 37 38 39 40 |
# File 'lib/onstomp/components/scopes.rb', line 36 def with_headers headers OnStomp::Components::Scopes::HeaderScope.new(headers, self).tap do |h| yield h if block_given? end end |
- (OnStomp::Components::Scopes::ReceiptScope) with_receipt {|r| ... }
Creates a new ReceiptScope. Any receipt-able frame generated on this scope will automatically have the supplied callback attached as a RECEIPT handler.
11 12 13 |
# File 'lib/onstomp/components/scopes.rb', line 11 def with_receipt &block OnStomp::Components::Scopes::ReceiptScope.new(block, self) end |