Class: TCPClient::Address
- Inherits:
-
Object
- Object
- TCPClient::Address
- Defined in:
- lib/tcp-client/address.rb
Instance Attribute Summary collapse
-
#addrinfo ⇒ Object
readonly
Returns the value of attribute addrinfo.
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#to_s ⇒ Object
readonly
Returns the value of attribute to_s.
Instance Method Summary collapse
-
#initialize(addr) ⇒ Address
constructor
A new instance of Address.
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
#addrinfo ⇒ Object (readonly)
Returns the value of attribute addrinfo.
7 8 9 |
# File 'lib/tcp-client/address.rb', line 7 def addrinfo @addrinfo end |
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
7 8 9 |
# File 'lib/tcp-client/address.rb', line 7 def hostname @hostname end |
#to_s ⇒ Object (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 |