This is an automated email from the ASF dual-hosted git repository.
astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
The following commit(s) were added to refs/heads/main by this push:
new ec535e7 PROTON-2498: [Ruby] Correctly fix binding for ruby 3.1 URI
module
ec535e7 is described below
commit ec535e772e02bd67a34a90d301c450758f53833e
Author: Andrew Stitcher <[email protected]>
AuthorDate: Fri Feb 11 12:58:00 2022 -0500
PROTON-2498: [Ruby] Correctly fix binding for ruby 3.1 URI module
---
ruby/lib/core/uri.rb | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/ruby/lib/core/uri.rb b/ruby/lib/core/uri.rb
index abced21..d5d0dd6 100644
--- a/ruby/lib/core/uri.rb
+++ b/ruby/lib/core/uri.rb
@@ -20,6 +20,13 @@ require 'uri'
# Extend the standard ruby {URI} with AMQP and AMQPS schemes
module URI
+ # monkey patch register_scheme for earlier versions of ruby
+ if !self.respond_to? :register_scheme
+ def self.register_scheme (scheme, klass)
+ @@schemes[scheme] = klass
+ end
+ end
+
# AMQP URI scheme for the AMQP protocol
class AMQP < Generic
DEFAULT_PORT = 5672
@@ -27,13 +34,13 @@ module URI
# @return [String] The AMQP address is the {#path} stripped of any leading
"/"
def amqp_address() path[0] == "/" ? path[1..-1] : path; end
end
- scheme_list['AMQP'] = AMQP
+ register_scheme 'AMQP', AMQP
# AMQPS URI scheme for the AMQP protocol over TLS
class AMQPS < AMQP
DEFAULT_PORT = 5671
end
- scheme_list['AMQPS'] = AMQPS
+ register_scheme 'AMQPS', AMQPS
end
module Qpid::Proton
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]