Class: DRb::DRbServer
- Inherits:
-
Object
- Object
- DRb::DRbServer
- Defined in:
- lib/opal/drb/drb_server.rb
Instance Method Summary collapse
-
#initialize(uri) ⇒ DRbServer
constructor
A new instance of DRbServer.
- #print_error(e) ⇒ Object
- #run ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(uri) ⇒ DRbServer
Returns a new instance of DRbServer.
3 4 5 6 |
# File 'lib/opal/drb/drb_server.rb', line 3 def initialize(uri) @protocol = DRbProtocol.open_server(uri) run end |
Instance Method Details
#print_error(e) ⇒ Object
30 31 32 33 |
# File 'lib/opal/drb/drb_server.rb', line 30 def print_error(e) puts e. p e.backtrace end |
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/opal/drb/drb_server.rb', line 12 def run @protocol.accept do |client| run begin succ = false invoke_method = InvokeMethod.new(self, client) succ, result = invoke_method.perform print_error(result) unless succ client.send_reply(succ, result) rescue Exception => e print_error(e) ensure client.close unless succ break unless succ end end end |
#uri ⇒ Object
8 9 10 |
# File 'lib/opal/drb/drb_server.rb', line 8 def uri @protocol.uri end |