Module: Qpid::Proton::Util::SwigHelper::ClassMethods
- Defined in:
- lib/util/swig_helper.rb
Overview
:nodoc:
Instance Method Summary collapse
- #create_wrapper_method(name, proton_method, with_arg = false) ⇒ Object
- #proton_accessor(name, options = {}) ⇒ Object
-
#proton_caller(name, options = {}) ⇒ Object
Defines a method that calls an underlying C library function.
- #proton_reader(name, options = {}) ⇒ Object
- #proton_writer(name, options = {}) ⇒ Object
Instance Method Details
#create_wrapper_method(name, proton_method, with_arg = false) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/util/swig_helper.rb', line 72 def create_wrapper_method(name, proton_method, with_arg = false) if with_arg define_method "#{name}" do |arg| Cproton.__send__(proton_method.to_sym, @impl, arg) end else define_method "#{name}" do Cproton.__send__(proton_method.to_sym, @impl) end end end |
#proton_accessor(name, options = {}) ⇒ Object
105 106 107 108 |
# File 'lib/util/swig_helper.rb', line 105 def proton_accessor(name, = {}) proton_writer(name, ) proton_reader(name, ) end |
#proton_caller(name, options = {}) ⇒ Object
Defines a method that calls an underlying C library function.
85 86 87 88 89 90 |
# File 'lib/util/swig_helper.rb', line 85 def proton_caller(name, = {}) proton_method = "#{self::PROTON_METHOD_PREFIX}_#{name}" # drop the trailing '?' if this is a property method proton_method = proton_method[0..-2] if proton_method.end_with? "?" create_wrapper_method(name, proton_method) end |
#proton_reader(name, options = {}) ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/util/swig_helper.rb', line 97 def proton_reader(name, = {}) an_is_method = [:is_or_get] == :is prefix = (an_is_method) ? "is" : "get" proton_method = "#{self::PROTON_METHOD_PREFIX}_#{prefix}_#{name}" name = "#{name}?" if an_is_method create_wrapper_method(name, proton_method) end |
#proton_writer(name, options = {}) ⇒ Object
92 93 94 95 |
# File 'lib/util/swig_helper.rb', line 92 def proton_writer(name, = {}) proton_method = "#{self::PROTON_METHOD_PREFIX}_set_#{name}" create_wrapper_method("#{name}=", proton_method, true) end |