Public Class methods
new(origin, path, options)
[show source]
# File lib/httpx/io/unix.rb 11 def initialize(origin, path, options) 12 @addresses = [] 13 @hostname = origin.host 14 @state = :idle 15 @options = options 16 @fallback_protocol = @options.fallback_protocol 17 if @options.io 18 @io = case @options.io 19 when Hash 20 @options.io[origin.authority] 21 else 22 @options.io 23 end 24 raise Error, "Given IO objects do not match the request authority" unless @io 25 26 @path = @io.path 27 @keep_open = true 28 @state = :connected 29 elsif path 30 @path = path 31 else 32 raise Error, "No path given where to store the socket" 33 end 34 @io ||= build_socket 35 end
Public Instance methods
connect()
[show source]
# File lib/httpx/io/unix.rb 37 def connect 38 return unless closed? 39 40 begin 41 if @io.closed? 42 transition(:idle) 43 @io = build_socket 44 end 45 @io.connect_nonblock(Socket.sockaddr_un(@path)) 46 rescue Errno::EISCONN 47 end 48 transition(:connected) 49 rescue Errno::EINPROGRESS, 50 Errno::EALREADY, 51 ::IO::WaitReadable 52 end
inspect()
:nocov:
[show source]
# File lib/httpx/io/unix.rb 59 def inspect 60 "#<#{self.class}(path: #{@path}): (state: #{@state})>" 61 end