Class: Tortard::Address
- Inherits:
-
Object
- Object
- Tortard::Address
- Defined in:
- lib/tortard/address.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(host, port) ⇒ Address
constructor
A new instance of Address.
- #to_s ⇒ Object
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
#host ⇒ Object (readonly)
Returns the value of attribute host.
20 21 22 |
# File 'lib/tortard/address.rb', line 20 def host @host end |
#port ⇒ Object (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_s ⇒ Object
27 28 29 |
# File 'lib/tortard/address.rb', line 27 def to_s "#{host}:#{port}" end |