PROTON-1537: [ruby] Move `deprecated` into Qpid module Minor fixup of doc comments, removed dead code in Qpid module.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/56902090 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/56902090 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/56902090 Branch: refs/heads/go1 Commit: 56902090d59f44abff6c4c15f371244eefa3face Parents: 56b0949 Author: Alan Conway <[email protected]> Authored: Tue Dec 5 14:30:26 2017 -0500 Committer: Alan Conway <[email protected]> Committed: Tue Dec 5 16:54:52 2017 -0500 ---------------------------------------------------------------------- proton-c/bindings/ruby/lib/core/connection.rb | 4 +-- proton-c/bindings/ruby/lib/core/delivery.rb | 2 +- proton-c/bindings/ruby/lib/core/disposition.rb | 2 +- proton-c/bindings/ruby/lib/core/event.rb | 2 +- proton-c/bindings/ruby/lib/core/link.rb | 2 +- proton-c/bindings/ruby/lib/core/uri.rb | 3 +- proton-c/bindings/ruby/lib/core/url.rb | 2 +- .../bindings/ruby/lib/messenger/messenger.rb | 6 ++-- proton-c/bindings/ruby/lib/qpid_proton.rb | 38 ++++++++------------ proton-c/bindings/ruby/lib/reactor/container.rb | 2 +- proton-c/bindings/ruby/spec/data_spec.rb | 4 +-- .../ruby/spec/exception_handling_spec.rb | 4 +-- proton-c/bindings/ruby/spec/message_spec.rb | 4 +-- 13 files changed, 34 insertions(+), 41 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/lib/core/connection.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/core/connection.rb b/proton-c/bindings/ruby/lib/core/connection.rb index c2f477c..3715080 100644 --- a/proton-c/bindings/ruby/lib/core/connection.rb +++ b/proton-c/bindings/ruby/lib/core/connection.rb @@ -61,10 +61,10 @@ module Qpid::Proton public # @deprecated no replacement - def overrides?() deprecated __method__; false; end + def overrides?() Qpid.deprecated __method__; false; end # @deprecated no replacement - def session_policy?() deprecated __method__; false; end + def session_policy?() Qpid.deprecated __method__; false; end # @return [Connection] self def connection() self; end http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/lib/core/delivery.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/core/delivery.rb b/proton-c/bindings/ruby/lib/core/delivery.rb index 838671f..30307f6 100644 --- a/proton-c/bindings/ruby/lib/core/delivery.rb +++ b/proton-c/bindings/ruby/lib/core/delivery.rb @@ -62,7 +62,7 @@ module Qpid::Proton # @deprecated use {#release} with modification options def modify() - deprecated __method__, "#release" + Qpid.deprecated __method__, "#release" release failed=>true end http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/lib/core/disposition.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/core/disposition.rb b/proton-c/bindings/ruby/lib/core/disposition.rb index 38fab6b..3a24f7a 100644 --- a/proton-c/bindings/ruby/lib/core/disposition.rb +++ b/proton-c/bindings/ruby/lib/core/disposition.rb @@ -32,7 +32,7 @@ module Qpid::Proton # @private def initialize(impl, local) - deprecated self.class, Delivery + Qpid.deprecated self.class, Delivery @impl = impl @local = local @data = nil http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/lib/core/event.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/core/event.rb b/proton-c/bindings/ruby/lib/core/event.rb index e62214b..552a605 100644 --- a/proton-c/bindings/ruby/lib/core/event.rb +++ b/proton-c/bindings/ruby/lib/core/event.rb @@ -151,7 +151,7 @@ module Qpid::Proton end # @deprecated use {#container} - def reactor() deprecated __method__, :container; container; end + def reactor() Qpid.deprecated __method__, :container; container; end # @deprecated use {Qpid::Proton::Event} Event = self http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/lib/core/link.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/core/link.rb b/proton-c/bindings/ruby/lib/core/link.rb index 370fb61..e525aa9 100644 --- a/proton-c/bindings/ruby/lib/core/link.rb +++ b/proton-c/bindings/ruby/lib/core/link.rb @@ -291,7 +291,7 @@ module Qpid::Proton # @deprecated use {Sender#send} def delivery(tag) - deprecated __method__, "Sender#send" + Qpid.deprecated __method__, "Sender#send" Delivery.new(Cproton.pn_delivery(@impl, tag)) end http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/lib/core/uri.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/core/uri.rb b/proton-c/bindings/ruby/lib/core/uri.rb index 636d20f..e9c5add 100644 --- a/proton-c/bindings/ruby/lib/core/uri.rb +++ b/proton-c/bindings/ruby/lib/core/uri.rb @@ -19,12 +19,13 @@ require 'uri' +# Extend the standard ruby {URI} with AMQP and AMQPS schemes module URI # AMQP URI scheme for the AMQP protocol class AMQP < Generic DEFAULT_PORT = 5672 - # Get the AMQP address: the {#path} minus any leading "/" + # @return [String] The AMQP address is the {#path} stripped of any leading "/" def amqp_address() path[0] == "/" ? path[1..-1] : path; end end @@schemes['AMQP'] = AMQP http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/lib/core/url.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/core/url.rb b/proton-c/bindings/ruby/lib/core/url.rb index 6bd7ece..88545e3 100644 --- a/proton-c/bindings/ruby/lib/core/url.rb +++ b/proton-c/bindings/ruby/lib/core/url.rb @@ -33,7 +33,7 @@ module Qpid::Proton # Parse a string, return a new URL # @param url [#to_s] the URL string def initialize(url = nil) - deprecated self.class, 'URI or String' + Qpid.deprecated self.class, 'URI or String' if url @url = Cproton.pn_url_parse(url.to_s) if @url.nil? http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/lib/messenger/messenger.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/messenger/messenger.rb b/proton-c/bindings/ruby/lib/messenger/messenger.rb index aaeee1e..65e0ae8 100644 --- a/proton-c/bindings/ruby/lib/messenger/messenger.rb +++ b/proton-c/bindings/ruby/lib/messenger/messenger.rb @@ -1,4 +1,4 @@ -# +# -- # 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 @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# +# ++ module Qpid::Proton::Messenger # @deprecated use {Qpid::Proton::Container} @@ -73,7 +73,7 @@ module Qpid::Proton::Messenger # * name - the name (def. nil) # def initialize(name = nil) - deprecated 'Qpid::Proton::Messenger', 'Qpid::Proton::Container' + Qpid.deprecated 'Qpid::Proton::Messenger', 'Qpid::Proton::Container' @impl = Cproton.pn_messenger(name) @selectables = {} ObjectSpace.define_finalizer(self, self.class.finalize!(@impl)) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/lib/qpid_proton.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb index f92f2df..36c14a1 100644 --- a/proton-c/bindings/ruby/lib/qpid_proton.rb +++ b/proton-c/bindings/ruby/lib/qpid_proton.rb @@ -27,10 +27,19 @@ rescue LoadError require "kconv" # Ruby < 1.9 end -DEPRECATION = "[DEPRECATION]" -def deprecated(old, new=nil) - repl = new ? "use `#{new}`" : "internal use only" - warn "#{DEPRECATION} `#{old}` is deprecated, #{repl} (called from #{caller(2).first})" +# Qpid is the top level module for the Qpid project http://qpid.apache.org +# Definitions for this library are in module {Qpid::Proton} +module Qpid + # @private + def self.deprecated(old, new=nil) + repl = new ? "use `#{new}`" : "internal use only" + warn "[DEPRECATION] `#{old}` is deprecated, #{repl} (called from #{caller(2).first})" + end + + # Proton is a ruby API for sending and receiving AMQP messages in clients or servers. + # {overveiw}[README.rdoc] + module Proton + end end # Exception classes @@ -85,35 +94,18 @@ require "messenger/messenger" # Handler classes require "handler/adapter" - # Core classes that depend on Handler require "core/messaging_handler" require "core/container" require "core/connection_driver" # Backwards compatibility shims + require "reactor/container" module Qpid::Proton::Handler - # TODO aconway 2017-12-05: replace with back-compatible handler + # @deprecated alias for backwards compatibility MessagingHandler = Qpid::Proton::MessagingHandler end -module Qpid::Proton - private - def self.registry - @registry ||= {} - end - - def self.add_to_registry(key, value) - self.registry[key] = value - end - - def self.get_from_registry(key) - self.registry[key] - end - def self.delete_from_registry(key) - self.registry.delete(key) - end -end http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/lib/reactor/container.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/reactor/container.rb b/proton-c/bindings/ruby/lib/reactor/container.rb index 41b2a88..9c6b13d 100644 --- a/proton-c/bindings/ruby/lib/reactor/container.rb +++ b/proton-c/bindings/ruby/lib/reactor/container.rb @@ -29,7 +29,7 @@ module Qpid::Proton::Reactor # @deprecated use {Qpid::Proton::Container} def initialize(handlers, opts=nil) - deprecated self.class, "Qpid::Proton::Container" + Qpid.deprecated self.class, "Qpid::Proton::Container" super handlers || (opts && opts[:global_handler]), opts && opts[:container_id] end http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/spec/data_spec.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/spec/data_spec.rb b/proton-c/bindings/ruby/spec/data_spec.rb index 99c269c..3123f61 100644 --- a/proton-c/bindings/ruby/spec/data_spec.rb +++ b/proton-c/bindings/ruby/spec/data_spec.rb @@ -1,4 +1,4 @@ -# +# -- # 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 @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# +# ++ require "spec_helper" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/spec/exception_handling_spec.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/spec/exception_handling_spec.rb b/proton-c/bindings/ruby/spec/exception_handling_spec.rb index 129bba4..a78dcd9 100644 --- a/proton-c/bindings/ruby/spec/exception_handling_spec.rb +++ b/proton-c/bindings/ruby/spec/exception_handling_spec.rb @@ -1,4 +1,4 @@ -# +# -- # 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 @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# +# ++ require "spec_helper" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56902090/proton-c/bindings/ruby/spec/message_spec.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/spec/message_spec.rb b/proton-c/bindings/ruby/spec/message_spec.rb index f36a64b..6486d24 100644 --- a/proton-c/bindings/ruby/spec/message_spec.rb +++ b/proton-c/bindings/ruby/spec/message_spec.rb @@ -1,4 +1,4 @@ -# +# -- # 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 @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# +# ++ require "spec_helper" --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
