Sha256: 6d2df2649d42e4c70b76314bbe25bb4d76508c5781471da4b58e1629143ba246
Contents?: true
Size: 1.15 KB
Versions: 13
Compression:
Stored size: 1.15 KB
Contents
# -*- encoding: utf-8 -*- require 'open-uri' class OnStomp::Components::URI::STOMP # Creates a new {OnStomp::Client}, extends it with # {OnStomp::OpenURI::ClientExtensions} and either returns it directly or # connects it, yields it to a given block and the disconnects it. # @param [arg1, arg2, ...] args additional arguments to pass to {OnStomp::Client#initialize} # @yield [client] block to evaluate within a connected client # @yieldparam [OnStomp::Client] client # @return [OnStomp::Client] def open(*args) client = OnStomp::Client.new(self, *args) client.extend OnStomp::OpenURI::ClientExtensions client.auto_destination = self.path if block_given? begin client.connect yield client ensure client.disconnect end end client end end # Namespace for OnStomp open-uri extensions. module OnStomp::OpenURI # Raised if a client's # {OnStomp::OpenURI::ClientExtensions#auto_destination auto_destination} has # not been properly set. class UnusableDestinationError < OnStomp::OnStompError; end end require 'onstomp/open-uri/message_queue' require 'onstomp/open-uri/client_extensions'
Version data entries
13 entries across 13 versions & 1 rubygems