Class: Yast::SystemdSocketClass

Inherits:
Module
  • Object
show all
Defined in:
library/systemd/src/modules/systemd_socket.rb

Defined Under Namespace

Classes: Socket

Constant Summary

UNIT_SUFFIX =
".socket".freeze

Instance Method Summary collapse

Instance Method Details

#all(propmap = {}) ⇒ Object

Parameters:



85
86
87
88
89
90
# File 'library/systemd/src/modules/systemd_socket.rb', line 85

def all(propmap = {})
  sockets = Systemctl.socket_units.map do |socket_unit|
    Socket.new(socket_unit, propmap)
  end
  sockets.select { |s| s.properties.supported? }
end

#find(socket_name, propmap = {}) ⇒ Object

Parameters:



72
73
74
75
76
77
# File 'library/systemd/src/modules/systemd_socket.rb', line 72

def find(socket_name, propmap = {})
  socket_name += UNIT_SUFFIX unless socket_name.end_with?(UNIT_SUFFIX)
  socket = Socket.new(socket_name, propmap)
  return nil if socket.properties.not_found?
  socket
end

#find!(socket_name, propmap = {}) ⇒ Object

Parameters:



80
81
82
# File 'library/systemd/src/modules/systemd_socket.rb', line 80

def find!(socket_name, propmap = {})
  find(socket_name, propmap) || raise(SystemdSocketNotFound, socket_name)
end