Class: Vedeu::Distributed::Uri

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/distributed/uri.rb

Overview

Value class which provides the host and port for the DRb server and client.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host = 'localhost', port = 21_420) ⇒ Vedeu::Distributed::Uri

Returns a new instance of Vedeu::Distributed::Uri.



26
27
28
29
# File 'lib/vedeu/distributed/uri.rb', line 26

def initialize(host = 'localhost', port = 21_420)
  @host = host || 'localhost'
  @port = port || 21_420
end

Instance Attribute Details

#hostString (readonly)



15
16
17
# File 'lib/vedeu/distributed/uri.rb', line 15

def host
  @host
end

#portFixnum|String (readonly)



19
20
21
# File 'lib/vedeu/distributed/uri.rb', line 19

def port
  @port
end

Instance Method Details

#to_sString Also known as: to_str

Returns The host and port as a single value.

Examples:

'druby://localhost:21420'


35
36
37
# File 'lib/vedeu/distributed/uri.rb', line 35

def to_s
  "druby://#{host}:#{port}".freeze
end