Skip to content

Commit ec535e7

Browse files
committed
PROTON-2498: [Ruby] Correctly fix binding for ruby 3.1 URI module
1 parent 6bcdfeb commit ec535e7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ruby/lib/core/uri.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,27 @@
2020

2121
# Extend the standard ruby {URI} with AMQP and AMQPS schemes
2222
module URI
23+
# monkey patch register_scheme for earlier versions of ruby
24+
if !self.respond_to? :register_scheme
25+
def self.register_scheme (scheme, klass)
26+
@@schemes[scheme] = klass
27+
end
28+
end
29+
2330
# AMQP URI scheme for the AMQP protocol
2431
class AMQP < Generic
2532
DEFAULT_PORT = 5672
2633

2734
# @return [String] The AMQP address is the {#path} stripped of any leading "/"
2835
def amqp_address() path[0] == "/" ? path[1..-1] : path; end
2936
end
30-
scheme_list['AMQP'] = AMQP
37+
register_scheme 'AMQP', AMQP
3138

3239
# AMQPS URI scheme for the AMQP protocol over TLS
3340
class AMQPS < AMQP
3441
DEFAULT_PORT = 5671
3542
end
36-
scheme_list['AMQPS'] = AMQPS
43+
register_scheme 'AMQPS', AMQPS
3744
end
3845

3946
module Qpid::Proton

0 commit comments

Comments
 (0)