blob: d864913d1549541d2fe663882eb82cba03d1dcd5 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Qpid::Proton
&mdash; Qpid Proton Ruby API
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Qpid::Proton";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (P)</a> &raquo;
<span class='title'><span class='object_link'><a href="../Qpid.html" title="Qpid (module)">Qpid</a></span></span>
&raquo;
<span class="title">Proton</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Qpid::Proton
</h1>
<div class="box_info">
<dl>
<dt>Defined in:</dt>
<dd>lib/qpid_proton.rb<span class="defines">,<br />
lib/types/array.rb,<br /> lib/core/message.rb,<br /> lib/core/session.rb,<br /> lib/core/tracker.rb,<br /> lib/util/wrapper.rb,<br /> lib/codec/mapping.rb,<br /> lib/core/delivery.rb,<br /> lib/core/endpoint.rb,<br /> lib/core/listener.rb,<br /> lib/core/receiver.rb,<br /> lib/core/terminus.rb,<br /> lib/core/transfer.rb,<br /> lib/util/schedule.rb,<br /> lib/core/condition.rb,<br /> lib/core/container.rb,<br /> lib/core/transport.rb,<br /> lib/core/connection.rb,<br /> lib/core/exceptions.rb,<br /> lib/core/ssl_domain.rb,<br /> lib/core/work_queue.rb,<br /> lib/handler/adapter.rb,<br /> lib/core/disposition.rb,<br /> lib/core/ssl_details.rb,<br /> lib/reactor/container.rb,<br /> lib/core/connection_driver.rb,<br /> lib/core/messaging_handler.rb,<br /> lib/handler/messaging_adapter.rb,<br /> lib/handler/messaging_handler.rb,<br /> lib/handler/reactor_messaging_adapter.rb,<br /> lib/core/sender.rb,<br /> lib/types/type.rb,<br /> lib/core/event.rb,<br /> lib/codec/data.rb,<br /> lib/core/sasl.rb,<br /> lib/core/link.rb,<br /> lib/core/url.rb,<br /> lib/core/uri.rb,<br /> lib/core/ssl.rb</span>
</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at</p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_http'>http</span><span class='symbol'>:/</span><span class='op'>/</span><span class='id identifier rubyid_www'>www</span><span class='period'>.</span><span class='id identifier rubyid_apache'>apache</span><span class='period'>.</span><span class='id identifier rubyid_org'>org</span><span class='op'>/</span><span class='id identifier rubyid_licenses'>licenses</span><span class='op'>/</span><span class='const'>LICENSE</span><span class='op'>-</span><span class='float'>2.0</span>
</code></pre>
<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p>
</div>
</div>
<div class="tags">
</div><h2>Defined Under Namespace</h2>
<p class="children">
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Proton/Handler.html" title="Qpid::Proton::Handler (module)">Handler</a></span>, <span class='object_link'><a href="Proton/Reactor.html" title="Qpid::Proton::Reactor (module)">Reactor</a></span>, <span class='object_link'><a href="Proton/Types.html" title="Qpid::Proton::Types (module)">Types</a></span>, <span class='object_link'><a href="Proton/Util.html" title="Qpid::Proton::Util (module)">Util</a></span>
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Proton/AbortedError.html" title="Qpid::Proton::AbortedError (class)">AbortedError</a></span>, <span class='object_link'><a href="Proton/ArgumentError.html" title="Qpid::Proton::ArgumentError (class)">ArgumentError</a></span>, <span class='object_link'><a href="Proton/AttributeError.html" title="Qpid::Proton::AttributeError (class)">AttributeError</a></span>, <span class='object_link'><a href="Proton/Condition.html" title="Qpid::Proton::Condition (class)">Condition</a></span>, <span class='object_link'><a href="Proton/Connection.html" title="Qpid::Proton::Connection (class)">Connection</a></span>, <span class='object_link'><a href="Proton/ConnectionDriver.html" title="Qpid::Proton::ConnectionDriver (class)">ConnectionDriver</a></span>, <span class='object_link'><a href="Proton/Container.html" title="Qpid::Proton::Container (class)">Container</a></span>, <span class='object_link'><a href="Proton/Delivery.html" title="Qpid::Proton::Delivery (class)">Delivery</a></span>, <span class='object_link'><a href="Proton/Disposition.html" title="Qpid::Proton::Disposition (class)">Disposition</a></span>, <span class='object_link'><a href="Proton/EOSError.html" title="Qpid::Proton::EOSError (class)">EOSError</a></span>, <span class='object_link'><a href="Proton/Endpoint.html" title="Qpid::Proton::Endpoint (class)">Endpoint</a></span>, <span class='object_link'><a href="Proton/Event.html" title="Qpid::Proton::Event (class)">Event</a></span>, <span class='object_link'><a href="Proton/HandlerDriver.html" title="Qpid::Proton::HandlerDriver (class)">HandlerDriver</a></span>, <span class='object_link'><a href="Proton/InProgressError.html" title="Qpid::Proton::InProgressError (class)">InProgressError</a></span>, <span class='object_link'><a href="Proton/InterruptedError.html" title="Qpid::Proton::InterruptedError (class)">InterruptedError</a></span>, <span class='object_link'><a href="Proton/Link.html" title="Qpid::Proton::Link (class)">Link</a></span>, <span class='object_link'><a href="Proton/LinkError.html" title="Qpid::Proton::LinkError (class)">LinkError</a></span>, <span class='object_link'><a href="Proton/Listener.html" title="Qpid::Proton::Listener (class)">Listener</a></span>, <span class='object_link'><a href="Proton/Message.html" title="Qpid::Proton::Message (class)">Message</a></span>, <span class='object_link'><a href="Proton/MessagingHandler.html" title="Qpid::Proton::MessagingHandler (class)">MessagingHandler</a></span>, <span class='object_link'><a href="Proton/OverflowError.html" title="Qpid::Proton::OverflowError (class)">OverflowError</a></span>, <span class='object_link'><a href="Proton/ProtonError.html" title="Qpid::Proton::ProtonError (class)">ProtonError</a></span>, <span class='object_link'><a href="Proton/Receiver.html" title="Qpid::Proton::Receiver (class)">Receiver</a></span>, <span class='object_link'><a href="Proton/Reject.html" title="Qpid::Proton::Reject (class)">Reject</a></span>, <span class='object_link'><a href="Proton/Release.html" title="Qpid::Proton::Release (class)">Release</a></span>, <span class='object_link'><a href="Proton/SASL.html" title="Qpid::Proton::SASL (class)">SASL</a></span>, <span class='object_link'><a href="Proton/SASLError.html" title="Qpid::Proton::SASLError (class)">SASLError</a></span>, <span class='object_link'><a href="Proton/SSL.html" title="Qpid::Proton::SSL (class)">SSL</a></span>, <span class='object_link'><a href="Proton/SSLDomain.html" title="Qpid::Proton::SSLDomain (class)">SSLDomain</a></span>, <span class='object_link'><a href="Proton/SSLError.html" title="Qpid::Proton::SSLError (class)">SSLError</a></span>, <span class='object_link'><a href="Proton/SSLUnavailableError.html" title="Qpid::Proton::SSLUnavailableError (class)">SSLUnavailableError</a></span>, <span class='object_link'><a href="Proton/Sender.html" title="Qpid::Proton::Sender (class)">Sender</a></span>, <span class='object_link'><a href="Proton/Session.html" title="Qpid::Proton::Session (class)">Session</a></span>, <span class='object_link'><a href="Proton/SessionError.html" title="Qpid::Proton::SessionError (class)">SessionError</a></span>, <span class='object_link'><a href="Proton/StateError.html" title="Qpid::Proton::StateError (class)">StateError</a></span>, <span class='object_link'><a href="Proton/StopAutoResponse.html" title="Qpid::Proton::StopAutoResponse (class)">StopAutoResponse</a></span>, <span class='object_link'><a href="Proton/StoppedError.html" title="Qpid::Proton::StoppedError (class)">StoppedError</a></span>, <span class='object_link'><a href="Proton/Terminus.html" title="Qpid::Proton::Terminus (class)">Terminus</a></span>, <span class='object_link'><a href="Proton/TimeoutError.html" title="Qpid::Proton::TimeoutError (class)">TimeoutError</a></span>, <span class='object_link'><a href="Proton/Tracker.html" title="Qpid::Proton::Tracker (class)">Tracker</a></span>, <span class='object_link'><a href="Proton/Transfer.html" title="Qpid::Proton::Transfer (class)">Transfer</a></span>, <span class='object_link'><a href="Proton/Transport.html" title="Qpid::Proton::Transport (class)">Transport</a></span>, <span class='object_link'><a href="Proton/TransportError.html" title="Qpid::Proton::TransportError (class)">TransportError</a></span>, <span class='object_link'><a href="Proton/URL.html" title="Qpid::Proton::URL (class)">URL</a></span>, <span class='object_link'><a href="Proton/UnderflowError.html" title="Qpid::Proton::UnderflowError (class)">UnderflowError</a></span>, <span class='object_link'><a href="Proton/WorkQueue.html" title="Qpid::Proton::WorkQueue (class)">WorkQueue</a></span>
</p>
<h2>
Class Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#uri-class_method" title="uri (class method)">.<strong>uri</strong>(s) &#x21d2; URI </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Convert <code>s</code> to an amqp: or amqps: URI.</p>
</div></span>
</li>
</ul>
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="uri-class_method">
.<strong>uri</strong>(s) &#x21d2; <tt><span class='object_link'>URI</span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Convert <code>s</code> to an amqp: or amqps: URI</p>
<p>This does not give the same result as the standard URI parser in all cases. Short-cut strings like “host:port” are allowed, an “amqp://” prefix is added if <code>s</code> does not already look like an &#39;amqp:&#39; or &#39;amqps:&#39; URI.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>s</span>
<span class='type'>(<tt>String</tt>, <tt><span class='object_link'>URI</span></tt>)</span>
&mdash;
<div class='inline'>
<p>String to convert to a URI, or a URI object.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'>URI</span></tt>)</span>
&mdash;
<div class='inline'>
<p>A valid AMQP or AMQPS URI</p>
</div>
</li>
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
<li>
<span class='type'>(<tt>URI::BadURIError</tt>)</span>
&mdash;
<div class='inline'>
<p>s is a URI object with a non-AMQP scheme</p>
</div>
</li>
<li>
<span class='type'>(<tt>URI::InvalidURIError</tt>)</span>
&mdash;
<div class='inline'>
<p>s cannot be parsed as a URI or shortcut</p>
</div>
</li>
<li>
<span class='type'>(<tt>::ArgumentError</tt>)</span>
&mdash;
<div class='inline'>
<p>s is not a string or URI</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/core/uri.rb', line 58</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_uri'>uri</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span>
<span class='kw'>case</span> <span class='id identifier rubyid_s'>s</span>
<span class='kw'>when</span> <span class='const'>URI</span><span class='op'>::</span><span class='const'>AMQP</span> <span class='kw'>then</span> <span class='id identifier rubyid_s'>s</span> <span class='comment'># This is already an AMQP or AMQPS URL.
</span> <span class='kw'>when</span> <span class='const'>URI</span><span class='op'>::</span><span class='const'>Generic</span> <span class='comment'># Re-parse a generic URI that was not parsed as AMQP/AMQPS class
</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_scheme'>scheme</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>amqp</span><span class='tstring_end'>&#39;</span></span> <span class='comment'># Default to amqp: scheme
</span> <span class='id identifier rubyid_u'>u</span> <span class='op'>=</span> <span class='const'>DEFAULT_URI_PARSER</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>URI</span><span class='op'>::</span><span class='const'>BadURIError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Not an AMQP URI: &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_u'>u</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_u'>u</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>URI</span><span class='op'>::</span><span class='const'>AMQP</span>
<span class='id identifier rubyid_u'>u</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='const'>String</span><span class='period'>.</span><span class='id identifier rubyid_try_convert'>try_convert</span> <span class='id identifier rubyid_s'>s</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bad argument (expected URI object or URI string)</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_s'>s</span>
<span class='kw'>case</span> <span class='id identifier rubyid_s'>s</span>
<span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>%r{</span><span class='tstring_content'>^amqps?:</span><span class='regexp_end'>}</span></span> <span class='kw'>then</span> <span class='const'>DEFAULT_URI_PARSER</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span> <span class='comment'># Looks like an AMQP URI
</span> <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>%r{</span><span class='tstring_content'>^//</span><span class='regexp_end'>}</span></span> <span class='kw'>then</span> <span class='const'>DEFAULT_URI_PARSER</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>amqp:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_s'>s</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='comment'># Looks like an authority with no scheme
</span> <span class='kw'>else</span> <span class='const'>DEFAULT_URI_PARSER</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>amqp://</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_s'>s</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='comment'># Treat as a bare host:port/path string
</span> <span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>rescue</span> <span class='op'>=&gt;</span><span class='id identifier rubyid_e'>e</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid___method__'>__method__</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>): </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Wed Nov 11 12:57:52 2020 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.24 (ruby-2.7.2).
</div>
</div>
</body>
</html>