class Backport::Server::Base

An extendable server class that provides basic start/stop functionality and common callbacks.

Public Instance Methods

start() click to toggle source

Start the server.

@return [void]

# File lib/backport/server/base.rb, line 14
def start
  return if started?
  starting
  @started = true
end
started?() click to toggle source
# File lib/backport/server/base.rb, line 31
def started?
  @started ||= false
end
starting() click to toggle source

A callback triggered when a Machine starts running or the server is added to a running machine. Subclasses should override this method to provide their own functionality.

@return [void]

# File lib/backport/server/base.rb, line 44
def starting; end
stop() click to toggle source

Stop the server.

@return [void]

# File lib/backport/server/base.rb, line 23
def stop
  return if stopped?
  stopping
  @started = false
  changed
  notify_observers self
end
stopped?() click to toggle source
# File lib/backport/server/base.rb, line 35
def stopped?
  !started?
end
stopping() click to toggle source

A callback triggered when the server is stopping. Subclasses should override this method to provide their own functionality.

@return [void]

# File lib/backport/server/base.rb, line 50
def stopping; end
tick() click to toggle source

A callback triggered from the main loop of a running Machine. Subclasses should override this method to provide their own functionality.

@return [void]

# File lib/backport/server/base.rb, line 57
def tick; end