PROTON-781: Added the Handler mixin to the Ruby reactive APIs.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/4b223272 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/4b223272 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/4b223272 Branch: refs/heads/cjansen-cpp-client Commit: 4b2232722b26e4e8d6207a97b0a5cad01fc8e61d Parents: 44ad0ff Author: Darryl L. Pierce <[email protected]> Authored: Wed Mar 4 08:06:19 2015 -0500 Committer: Darryl L. Pierce <[email protected]> Committed: Thu Jun 18 16:28:44 2015 -0400 ---------------------------------------------------------------------- proton-c/bindings/ruby/lib/qpid_proton.rb | 1 + proton-c/bindings/ruby/lib/util/handler.rb | 41 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4b223272/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 0c84f20..03f5632 100644 --- a/proton-c/bindings/ruby/lib/qpid_proton.rb +++ b/proton-c/bindings/ruby/lib/qpid_proton.rb @@ -41,6 +41,7 @@ require "util/class_wrapper" require "util/engine" require "util/uuid" require "util/timeout" +require "util/handler" # Types require "types/strings" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4b223272/proton-c/bindings/ruby/lib/util/handler.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/util/handler.rb b/proton-c/bindings/ruby/lib/util/handler.rb new file mode 100644 index 0000000..e7d07b1 --- /dev/null +++ b/proton-c/bindings/ruby/lib/util/handler.rb @@ -0,0 +1,41 @@ +#-- +# 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. +#++ + +module Qpid::Proton::Util + + # @private + module Handler + + def chandler(handler, on_error) + return nil if handler.nil? + + if handler.instance_of?(Qpid::Proton::Handler::WrappedHandler) + impl = handler.impl + Cproton.pn_incref(impl) + return impl + else + cadaptor = Qpid::Proton::Handler::CAdaptor.new(handler, on_error) + rbhandler = Cproton.pn_rbhandler(cadaptor) + return rbhandler + end + end + + end + +end --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
