Class: DBus::Systemd::Manager
Constant Summary
collapse
- NODE =
'/org/freedesktop/systemd1'
- INTERFACE =
'org.freedesktop.systemd1.Manager'
- UNIT_INDICES =
{
name: 0,
description: 1,
load_state: 2,
active_state: 3,
sub_state: 4,
following: 5,
object_path: 6,
job_id: 7,
job_type: 8,
job_object_path: 9
}
- JOB_INDICES =
{
id: 0,
unit: 1,
type: 2,
state: 3,
object_path: 4,
unit_object_path: 5
}
Instance Attribute Summary collapse
#object
Instance Method Summary
collapse
#properties
#method_missing, #respond_to_missing?
Constructor Details
#initialize(bus = Systemd::Helpers.system_bus) ⇒ Manager
Returns a new instance of Manager.
Instance Attribute Details
#service ⇒ Object
Returns the value of attribute service.
43
44
45
|
# File 'lib/dbus/systemd/manager.rb', line 43
def service
@service
end
|
Instance Method Details
#get_job_by_object_path(path) ⇒ Object
77
78
79
80
81
|
# File 'lib/dbus/systemd/manager.rb', line 77
def get_job_by_object_path(path)
obj = @service.object(path)
.tap(&:introspect)
Job.new(obj.Get(Job::INTERFACE, 'Id').first, self)
end
|
#get_unit_by_object_path(path) ⇒ Object
59
60
61
62
63
|
# File 'lib/dbus/systemd/manager.rb', line 59
def get_unit_by_object_path(path)
obj = @service.object(path)
.tap(&:introspect)
Unit.new(obj.Get(Unit::INTERFACE, 'Id').first, self)
end
|
#job(id) ⇒ Object
73
74
75
|
# File 'lib/dbus/systemd/manager.rb', line 73
def job(id)
Job.new(id, self)
end
|
#jobs ⇒ Object
69
70
71
|
# File 'lib/dbus/systemd/manager.rb', line 69
def jobs
self.ListJobs.first.map { |j| map_job(j) }
end
|
#map_job(job_array) ⇒ Object
#map_unit(unit_array) ⇒ Object
#unit(name) ⇒ Object
55
56
57
|
# File 'lib/dbus/systemd/manager.rb', line 55
def unit(name)
Unit.new(name, self)
end
|
#units ⇒ Object
51
52
53
|
# File 'lib/dbus/systemd/manager.rb', line 51
def units
self.ListUnits.first.map { |u| map_unit(u) }
end
|