Module: Qpid::Proton
- Defined in:
- lib/qpid_proton.rb,
lib/types/array.rb,
lib/core/message.rb,
lib/core/session.rb,
lib/core/tracker.rb,
lib/util/wrapper.rb,
lib/codec/mapping.rb,
lib/core/delivery.rb,
lib/core/endpoint.rb,
lib/core/listener.rb,
lib/core/receiver.rb,
lib/core/terminus.rb,
lib/core/transfer.rb,
lib/util/schedule.rb,
lib/core/condition.rb,
lib/core/container.rb,
lib/core/transport.rb,
lib/core/connection.rb,
lib/core/exceptions.rb,
lib/core/ssl_domain.rb,
lib/core/work_queue.rb,
lib/handler/adapter.rb,
lib/core/disposition.rb,
lib/core/ssl_details.rb,
lib/reactor/container.rb,
lib/core/connection_driver.rb,
lib/core/messaging_handler.rb,
lib/handler/messaging_adapter.rb,
lib/handler/messaging_handler.rb,
lib/handler/reactor_messaging_adapter.rb,
lib/core/sender.rb,
lib/types/type.rb,
lib/core/event.rb,
lib/codec/data.rb,
lib/core/sasl.rb,
lib/core/link.rb,
lib/core/url.rb,
lib/core/uri.rb,
lib/core/ssl.rb
Overview
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
http://www.apache.org/licenses/LICENSE-2.0
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.
Defined Under Namespace
Modules: Handler, Reactor, Types, Util Classes: AbortedError, ArgumentError, AttributeError, Condition, Connection, ConnectionDriver, Container, Delivery, Disposition, EOSError, Endpoint, Event, HandlerDriver, InProgressError, InterruptedError, Link, LinkError, Listener, Message, MessagingHandler, OverflowError, ProtonError, Receiver, Reject, Release, SASL, SASLError, SSL, SSLDomain, SSLError, SSLUnavailableError, Sender, Session, SessionError, StateError, StopAutoResponse, StoppedError, Terminus, TimeoutError, Tracker, Transfer, Transport, TransportError, URL, UnderflowError, WorkQueue
Class Method Summary collapse
-
.uri(s) ⇒ URI
Convert
s
to an amqp: or amqps: URI.
Class Method Details
.uri(s) ⇒ URI
Convert s
to an amqp: or amqps: URI
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 s
does not already look like an ‘amqp:’ or ‘amqps:’ URI.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/core/uri.rb', line 65 def self.uri(s) case s when URI::AMQP then s # This is already an AMQP or AMQPS URL. when URI::Generic # Re-parse a generic URI that was not parsed as AMQP/AMQPS class s.scheme ||= 'amqp' # Default to amqp: scheme u = DEFAULT_URI_PARSER.parse(s.to_s) raise URI::BadURIError, "Not an AMQP URI: '#{u}'" unless u.is_a? URI::AMQP u else s = String.try_convert s raise ::ArgumentError, "bad argument (expected URI object or URI string)" unless s case s when %r{^amqps?:} then DEFAULT_URI_PARSER.parse(s) # Looks like an AMQP URI when %r{^//} then DEFAULT_URI_PARSER.parse("amqp:#{s}") # Looks like an authority with no scheme else DEFAULT_URI_PARSER.parse("amqp://#{s}") # Treat as a bare host:port/path string end end rescue =>e raise e.class, "#{self}.#{__method__}(#{s.inspect}): #{e}" end |