module DBus::Systemd::Helpers

Public Class Methods

map_array(array, map) click to toggle source

map an array to a hash from an index map

@param array [Array] array to be mapped @param map [Hash] map of positional elements to array indices @return [Hash] hash with keys from map and values from array

# File lib/dbus/systemd/helpers.rb, line 48
def map_array(array, map)
  mapped = {}

  array.each_with_index do |item, index|
    mapped[map.key(index)] = item
  end

  mapped
end
session_bus() click to toggle source

get an instance of the session bus

@return [DBus::SessionBus]

# File lib/dbus/systemd/helpers.rb, line 38
def session_bus
  DBus::SessionBus.instance
end
system_bus() click to toggle source

get an instance of the system bus

@return [DBus::SystemBus]

# File lib/dbus/systemd/helpers.rb, line 30
def system_bus
  DBus::SystemBus.instance
end

Private Instance Methods

map_array(array, map) click to toggle source

map an array to a hash from an index map

@param array [Array] array to be mapped @param map [Hash] map of positional elements to array indices @return [Hash] hash with keys from map and values from array

# File lib/dbus/systemd/helpers.rb, line 48
def map_array(array, map)
  mapped = {}

  array.each_with_index do |item, index|
    mapped[map.key(index)] = item
  end

  mapped
end
session_bus() click to toggle source

get an instance of the session bus

@return [DBus::SessionBus]

# File lib/dbus/systemd/helpers.rb, line 38
def session_bus
  DBus::SessionBus.instance
end
system_bus() click to toggle source

get an instance of the system bus

@return [DBus::SystemBus]

# File lib/dbus/systemd/helpers.rb, line 30
def system_bus
  DBus::SystemBus.instance
end