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/f69b9727 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/f69b9727 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/f69b9727 Branch: refs/heads/PROTON-781-ruby-reactor-apis Commit: f69b9727f85768c07a46cd3759cc3c7bb342472c Parents: 5b72338 Author: Darryl L. Pierce <mcpie...@gmail.com> Authored: Wed Mar 4 08:06:19 2015 -0500 Committer: Darryl L. Pierce <mcpie...@gmail.com> Committed: Mon Jun 8 13:57:52 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/f69b9727/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/f69b9727/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: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org