Module: UnixSocks
- Defined in:
- lib/unix_socks.rb,
lib/unix_socks/version.rb
Overview
Provides classes for handling inter-process communication via Unix 🧦🧦. Supports dynamic message handling, background processing, and robust error management.
Defined Under Namespace
Modules: ServerError, ServerShared Classes: DomainSocketServer, Message, TCPSocketServer
Constant Summary collapse
- VERSION =
UnixSocks version
'0.4.0'- VERSION_ARRAY =
:nodoc:
VERSION.split('.').map(&:to_i)
- VERSION_MAJOR =
:nodoc:
VERSION_ARRAY[0]
- VERSION_MINOR =
:nodoc:
VERSION_ARRAY[1]
- VERSION_BUILD =
:nodoc:
VERSION_ARRAY[2]
Class Method Summary collapse
-
.from_url(url) ⇒ UnixSocks::DomainSocketServer, UnixSocks::TCPSocketServer
Creates a server instance from a URL string.
Class Method Details
.from_url(url) ⇒ UnixSocks::DomainSocketServer, UnixSocks::TCPSocketServer
Creates a server instance from a URL string.
This method parses a URL and constructs the appropriate server instance based on the scheme. For ‘unix’ URLs, it creates a DomainSocketServer, and for ‘tcp’ URLs, it creates a TCPSocketServer.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/unix_socks.rb', line 24 def self.from_url(url) uri = url.is_a?(URI) ? url : URI.parse(url.to_s) case uri.scheme when 'unix' DomainSocketServer.new( socket_name: File.basename(uri.path), runtime_dir: File.dirname(uri.path) ) when 'tcp' TCPSocketServer.new( hostname: uri.host, port: uri.port ) else raise ArgumentError, "Invalid URL #{url.to_s.inspect} for UnixSocks" end end |