Class: Backport::Server::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/backport/server/base.rb

Overview

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

Direct Known Subclasses

Interval, Stdio, Tcpip

Instance Method Summary collapse

Instance Method Details

#startObject

Start the server.



9
10
11
12
13
# File 'lib/backport/server/base.rb', line 9

def start
  return if started?
  starting
  @started = true
end

#started?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/backport/server/base.rb', line 23

def started?
  @started ||= false
end

#startingvoid

This method returns an undefined value.

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.



36
# File 'lib/backport/server/base.rb', line 36

def starting; end

#stopObject

Stop the server.



17
18
19
20
21
# File 'lib/backport/server/base.rb', line 17

def stop
  return if stopped?
  stopping
  @started = false
end

#stopped?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/backport/server/base.rb', line 27

def stopped?
  !started?
end

#stoppingvoid

This method returns an undefined value.

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



42
# File 'lib/backport/server/base.rb', line 42

def stopping; end

#tickvoid

This method returns an undefined value.

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



49
# File 'lib/backport/server/base.rb', line 49

def tick; end