class Del::SocketConnection

Public Class Methods

new(path:) click to toggle source
# File lib/del/socket_connection.rb, line 5
def initialize(path:)
  File.unlink(path) if File.exist?(path)
  @server = UNIXServer.new(path)
end

Public Instance Methods

on_receive() { |socket| ... } click to toggle source
# File lib/del/socket_connection.rb, line 10
def on_receive
  socket = @server.accept
  yield socket
rescue StandardError => error
  Del.logger.error(error)
ensure
  socket&.close
end