Class: DInstaller::DBus::LanguageService

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

Overview

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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_config, logger = nil) ⇒ LanguageService



46
47
48
49
# File 'lib/dinstaller/dbus/language_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



42
43
44
# File 'lib/dinstaller/dbus/language_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/language_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/language_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