Class: RubySL::Socket::Foreign::Hostent

Inherits:
Rubinius::FFI::Struct
  • Object
show all
Defined in:
lib/rubysl/socket/foreign/hostent.rb

Instance Method Summary collapse

Instance Method Details

#addressesObject



23
24
25
26
27
28
# File 'lib/rubysl/socket/foreign/hostent.rb', line 23

def addresses
  return [] unless self[:h_addr_list]

  RubySL::Socket::Foreign.pointers_of_type(self[:h_addr_list], :string)
    .map { |pointer| pointer.read_string(self[:h_length]) }
end

#aliasesObject



16
17
18
19
20
21
# File 'lib/rubysl/socket/foreign/hostent.rb', line 16

def aliases
  return [] unless self[:h_aliases]

  RubySL::Socket::Foreign.pointers_of_type(self[:h_aliases], :string)
    .map(&:read_string)
end

#hostnameObject



8
9
10
# File 'lib/rubysl/socket/foreign/hostent.rb', line 8

def hostname
  self[:h_name]
end

#to_sObject



30
31
32
# File 'lib/rubysl/socket/foreign/hostent.rb', line 30

def to_s
  pointer.read_string(size)
end

#typeObject



12
13
14
# File 'lib/rubysl/socket/foreign/hostent.rb', line 12

def type
  self[:h_addrtype]
end