Class: DBus::Systemd::Unit

Inherits:
Object
  • Object
show all
Includes:
Mixin::MethodMissing, Mixin::Properties
Defined in:
lib/dbus/systemd/unit.rb,
lib/dbus/systemd/unit/path.rb,
lib/dbus/systemd/unit/swap.rb,
lib/dbus/systemd/unit/mount.rb,
lib/dbus/systemd/unit/scope.rb,
lib/dbus/systemd/unit/slice.rb,
lib/dbus/systemd/unit/timer.rb,
lib/dbus/systemd/unit/device.rb,
lib/dbus/systemd/unit/socket.rb,
lib/dbus/systemd/unit/target.rb,
lib/dbus/systemd/unit/service.rb,
lib/dbus/systemd/unit/snapshot.rb,
lib/dbus/systemd/unit/automount.rb

Direct Known Subclasses

Automount, Device, Mount, Path, Scope, Service, Slice, Snapshot, Socket, Swap, Target, Timer

Defined Under Namespace

Classes: Automount, Device, Mount, Path, Scope, Service, Slice, Snapshot, Socket, Swap, Target, Timer

Constant Summary collapse

INTERFACE =

the unit dbus interface

'org.freedesktop.systemd1.Unit'.freeze

Instance Attribute Summary

Attributes included from Mixin::MethodMissing

#object

Instance Method Summary collapse

Methods included from Mixin::Properties

#properties

Methods included from Mixin::MethodMissing

#method_missing, #respond_to_missing?

Constructor Details

#initialize(name, manager = Manager.new) ⇒ Unit

create a new unit object for interfacing with systemd units

Parameters:

  • name (String)

    unit name

  • manager (DBus::Systemd::Manager) (defaults to: Manager.new)

    systemd manager object



38
39
40
41
42
43
# File 'lib/dbus/systemd/unit.rb', line 38

def initialize(name, manager = Manager.new)
  unit_path = manager.GetUnit(name).first
  @object = manager.service.object(unit_path)
  @object.default_iface = INTERFACE
  @object.introspect
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DBus::Systemd::Mixin::MethodMissing