Class: RubySL::Socket::Foreign::SockaddrUn
- Inherits:
-
Rubinius::FFI::Struct
- Object
- Rubinius::FFI::Struct
- RubySL::Socket::Foreign::SockaddrUn
- Defined in:
- lib/rubysl/socket/foreign/sockaddr_un.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.with_sockaddr(addr) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rubysl/socket/foreign/sockaddr_un.rb', line 7 def self.with_sockaddr(addr) if addr.bytesize > size raise ArgumentError, "UNIX socket path is too long (max: #{size} bytes)" end pointer = Foreign.memory_pointer(size) pointer.write_string(addr, addr.bytesize) new(pointer) end |
Instance Method Details
#family ⇒ Object
19 20 21 |
# File 'lib/rubysl/socket/foreign/sockaddr_un.rb', line 19 def family self[:sun_family] end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/rubysl/socket/foreign/sockaddr_un.rb', line 23 def to_s pointer.read_string(pointer.total) end |