Module: DBus::Systemd::Mixin::MethodMissing

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &blk) ⇒ Object

use method_missing to proxy methods to the dbus proxy object interface methods



33
34
35
36
37
38
39
# File 'lib/dbus/systemd/mixin.rb', line 33

def method_missing(name, *args, &blk)
  if @object.respond_to?(name)
    @object.send(name, *args, &blk)
  else
    super
  end
end

Instance Attribute Details

#objectObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns DBus::ProxyObject.

Returns:

  • DBus::ProxyObject



27
28
29
# File 'lib/dbus/systemd/mixin.rb', line 27

def object
  @object
end

Instance Method Details

#respond_to_missing?(*args) ⇒ Boolean

fix respond_to to also check the dbus methods

Returns:

  • (Boolean)


44
45
46
# File 'lib/dbus/systemd/mixin.rb', line 44

def respond_to_missing?(*args)
  @object.respond_to?(*args) || super
end