Class: Tlapse::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/tlapse/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host: "localhost", port: 9000) ⇒ Server

Returns a new instance of Server.



7
8
9
10
# File 'lib/tlapse/server.rb', line 7

def initialize(host: "localhost", port: 9000)
  @host = host
  @port = port
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/tlapse/server.rb', line 5

def host
  @host
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/tlapse/server.rb', line 5

def port
  @port
end

Instance Method Details

#full_hostObject



17
18
19
# File 'lib/tlapse/server.rb', line 17

def full_host
  "druby://#{@host}:#{@port}"
end

#serveObject



12
13
14
15
# File 'lib/tlapse/server.rb', line 12

def serve
  DRb.start_service full_host, drb_object
  DRb.thread.join # wait for commands
end