Class: DRb::Service

Inherits:
Object show all
Includes:
DRbUndumped
Defined in:
lib/drb/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Service

Returns a new instance of Service.



17
18
19
20
21
22
# File 'lib/drb/service.rb', line 17

def initialize(config={})
  @config = config
  @server = nil
  @uri = nil
  @front = nil
end

Instance Attribute Details

#frontObject (readonly)

Returns the value of attribute front.



24
25
26
# File 'lib/drb/service.rb', line 24

def front
  @front
end

#serverObject (readonly)

Returns the value of attribute server.



24
25
26
# File 'lib/drb/service.rb', line 24

def server
  @server
end

#uriObject (readonly)

Returns the value of attribute uri.



24
25
26
# File 'lib/drb/service.rb', line 24

def uri
  @uri
end

Instance Method Details

#start_service(uri) ⇒ Object



26
27
28
29
# File 'lib/drb/service.rb', line 26

def start_service(uri)
  @server = DRb.start_service(uri.nil? ? uri : uri.to_s, @front, @config)
  @uri = URI.parse(@server.uri)
end

#stop_serviceObject



31
32
33
# File 'lib/drb/service.rb', line 31

def stop_service
  @server.stop_service if @server
end

#threadObject



35
36
37
# File 'lib/drb/service.rb', line 35

def thread
  @server.thread if @server
end