Class: DBus::Systemd::Logind::Manager
Constant Summary
collapse
- NODE =
'/org/freedesktop/login1'
- INTERFACE =
'org.freedesktop.login1.Manager'
- SESSION_INDICES =
{
id: 0,
user_id: 1,
user_name: 2,
seat_id: 3,
object_path: 4
}
- USER_INDICES =
{
id: 0,
name: 1,
object_path: 2
}
- SEAT_INDICES =
{
id: 0,
object_path: 1
}
- INHIBITOR_INDICES =
{
what: 0,
who: 1,
why: 2,
mode: 3,
user_id: 4,
process_id: 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.
49
50
51
52
53
|
# File 'lib/dbus/systemd/logind/manager.rb', line 49
def initialize(bus = Systemd::Helpers.system_bus)
@service = bus.service(Logind::INTERFACE)
@object = @service.object(NODE)
.tap(&:introspect)
end
|
Instance Attribute Details
#service ⇒ Object
Returns the value of attribute service.
47
48
49
|
# File 'lib/dbus/systemd/logind/manager.rb', line 47
def service
@service
end
|
Instance Method Details
#get_seat_by_path(path) ⇒ Object
63
64
65
66
67
|
# File 'lib/dbus/systemd/logind/manager.rb', line 63
def get_seat_by_path(path)
obj = @service.object(path)
.tap(&:introspect)
Seat.new(obj.Get(Seat::INTERFACE, 'Id').first, self)
end
|
#get_session_by_path(path) ⇒ Object
81
82
83
84
85
|
# File 'lib/dbus/systemd/logind/manager.rb', line 81
def get_session_by_path(path)
obj = @service.object(path)
.tap(&:introspect)
Session.new(obj.Get(Session::INTERFACE, 'Id').first, self)
end
|
#get_user_by_path(path) ⇒ Object
99
100
101
102
103
|
# File 'lib/dbus/systemd/logind/manager.rb', line 99
def get_user_by_path(path)
obj = @service.object(path)
.tap(&:introspect)
User.new(obj.Get(User::INTERFACE, 'Id').first, self)
end
|
#map_seat(seat_array) ⇒ Object
69
70
71
|
# File 'lib/dbus/systemd/logind/manager.rb', line 69
def map_seat(seat_array)
Systemd::Helpers.map_array(seat_array, SEAT_INDICES)
end
|
#map_session(session_array) ⇒ Object
87
88
89
|
# File 'lib/dbus/systemd/logind/manager.rb', line 87
def map_session(session_array)
Systemd::Helpers.map_array(session_array, SESSION_INDICES)
end
|
#map_user(user_array) ⇒ Object
105
106
107
|
# File 'lib/dbus/systemd/logind/manager.rb', line 105
def map_user(user_array)
Systemd::Helpers.map_array(user_array, USER_INDICES)
end
|
#seat(id) ⇒ Object
59
60
61
|
# File 'lib/dbus/systemd/logind/manager.rb', line 59
def seat(id)
Seat.new(id, self)
end
|
#seats ⇒ Object
55
56
57
|
# File 'lib/dbus/systemd/logind/manager.rb', line 55
def seats
self.ListSeats.first.map { |s| map_seat(s) }
end
|
#session(id) ⇒ Object
77
78
79
|
# File 'lib/dbus/systemd/logind/manager.rb', line 77
def session(id)
Session.new(id, self)
end
|
#sessions ⇒ Object
73
74
75
|
# File 'lib/dbus/systemd/logind/manager.rb', line 73
def sessions
self.ListSessions.first.map { |s| map_session(s) }
end
|
#user(id) ⇒ Object
95
96
97
|
# File 'lib/dbus/systemd/logind/manager.rb', line 95
def user(id)
User.new(id, self)
end
|
#users ⇒ Object
91
92
93
|
# File 'lib/dbus/systemd/logind/manager.rb', line 91
def users
self.ListUsers.first.map { |u| map_user(u) }
end
|