Class: DInstaller::DBus::UsersService

Inherits:
Object
  • Object
show all
Defined in:
lib/dinstaller/dbus/users_service.rb

Overview

D-Bus service (org.opensuse.DInstaller.Users)

It connects to the system D-Bus and answers requests on objects below ‘/org/opensuse/DInstaller/Users1`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_config, logger = nil) ⇒ UsersService

Returns a new instance of UsersService.

Parameters:

  • config (Config)

    Configuration object

  • logger (Logger) (defaults to: nil)


46
47
48
49
# File 'lib/dinstaller/dbus/users_service.rb', line 46

def initialize(_config, logger = nil)
  @logger = logger || Logger.new($stdout)
  @bus = ::DBus::SystemBus.instance
end

Instance Attribute Details

#bus::DBus::Connection (readonly)

System D-Bus

Returns:

  • (::DBus::Connection)


42
43
44
# File 'lib/dinstaller/dbus/users_service.rb', line 42

def bus
  @bus
end

Instance Method Details

#dispatchObject

Call this from some main loop to dispatch the D-Bus messages



60
61
62
# File 'lib/dinstaller/dbus/users_service.rb', line 60

def dispatch
  bus.dispatch_message_queue
end

#exportObject

Exports the installer object through the D-Bus service



52
53
54
55
56
57
# File 'lib/dinstaller/dbus/users_service.rb', line 52

def export
  dbus_objects.each { |o| service.export(o) }

  paths = dbus_objects.map(&:path).join(", ")
  logger.info "Exported #{paths} objects"
end