Class: TCPClient::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/tcp-client/address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(addr) ⇒ Address

Returns a new instance of Address.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tcp-client/address.rb', line 9

def initialize(addr)
  case addr
  when self.class
    init_from_selfclass(addr)
  when Integer
    init_from_addrinfo(Addrinfo.tcp(nil, addr))
  when Addrinfo
    init_from_addrinfo(addr)
  else
    init_from_string(addr)
  end
  @addrinfo.freeze
end

Instance Attribute Details

#addrinfoObject (readonly)

Returns the value of attribute addrinfo.



7
8
9
# File 'lib/tcp-client/address.rb', line 7

def addrinfo
  @addrinfo
end

#hostnameObject (readonly)

Returns the value of attribute hostname.



7
8
9
# File 'lib/tcp-client/address.rb', line 7

def hostname
  @hostname
end

#to_sObject (readonly)

Returns the value of attribute to_s.



7
8
9
# File 'lib/tcp-client/address.rb', line 7

def to_s
  @to_s
end