Class: Tortard::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/tortard/address.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ Address

Returns a new instance of Address.



22
23
24
25
# File 'lib/tortard/address.rb', line 22

def initialize (host, port)
	@host = host
	@port = port.to_i
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



20
21
22
# File 'lib/tortard/address.rb', line 20

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



20
21
22
# File 'lib/tortard/address.rb', line 20

def port
  @port
end

Class Method Details

.parse(text) ⇒ Object



16
17
18
# File 'lib/tortard/address.rb', line 16

def self.parse (text)
	new(*text.split(?:))
end

Instance Method Details

#to_sObject



27
28
29
# File 'lib/tortard/address.rb', line 27

def to_s
	"#{host}:#{port}"
end