mvidner/ruby-dbus

redefininition of methods of DBus objects

tomasjura opened this issue · 1 comments

I have many warnings like this
/usr/lib/ruby/vendor_ruby/dbus/proxy_object.rb:94: warning: method redefined; discarding old Get

It is raised when dbus object is introspected more than one time.

I have solved by following patch, but I'm unsure if it is correct.

      univocal_meths.each do |name, intf|
        # creates a shortcut function that forwards each call to the method on
        # the appropriate intf
        singleton_class.class_eval do
+++          undef_method(name) if method_defined? name
          define_method name do |*args, &reply_handler|
            intf.method(name).call(*args, &reply_handler)
          end
        end
      end

Shouldn't be the method redefinition skipped instead?

Hi!
I am late, but the fix for this is 0fc1ae1 and it was included in v0.13.0 . Hope that helps!