Class: Nonnative::Server
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(service) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
- #stop ⇒ Object
Methods inherited from Service
Constructor Details
#initialize(service) ⇒ Server
Returns a new instance of Server.
5 6 7 8 9 10 |
# File 'lib/nonnative/server.rb', line 5 def initialize(service) @id = SecureRandom.hex(5) @proxy = Nonnative::ProxyFactory.create(service) super service end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/nonnative/server.rb', line 12 def start unless thread proxy.start @thread = Thread.new { perform_start } wait_start end id end |
#stop ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/nonnative/server.rb', line 23 def stop if thread perform_stop thread.terminate proxy.stop @thread = nil wait_stop end id end |