Class: DRb::ExtServ

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DRbUndumped

#_dump

Constructor Details

#initialize(there, name, server = nil) ⇒ ExtServ

Returns a new instance of ExtServ.



12
13
14
15
16
17
# File 'lib/drb/extserv.rb', line 12

def initialize(there, name, server=nil)
  @server = server || DRb::primary_server
  @name = name
  ro = DRbObject.new(nil, there)
  @invoker = ro.regist(name, DRbObject.new(self, @server.uri))
end

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server



18
19
20
# File 'lib/drb/extserv.rb', line 18

def server
  @server
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/drb/extserv.rb', line 32

def alive?
  @server ? @server.alive? : false
end

#frontObject



20
21
22
# File 'lib/drb/extserv.rb', line 20

def front
  DRbObject.new(nil, @server.uri)
end

#stop_serviceObject



24
25
26
27
28
29
30
# File 'lib/drb/extserv.rb', line 24

def stop_service
  @invoker.unregist(@name)
  server = @server
  @server = nil
  server.stop_service
  true
end