Class: Pokan::Cluster::Autorunner

Inherits:
Object
  • Object
show all
Defined in:
lib/pokan-cluster/autorunner.rb

Overview

Class used for automatically run a server that include Pokan::Cluster module.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.optionsObject

Returns the value of attribute options.



11
12
13
# File 'lib/pokan-cluster/autorunner.rb', line 11

def options
  @options
end

.serverObject

Returns the value of attribute server.



10
11
12
# File 'lib/pokan-cluster/autorunner.rb', line 10

def server
  @server
end

Class Method Details

.register_server(server_class) ⇒ Object

Registers a new server, that will be started when the method Pokan::Cluster::Autorunner.run gets called.



16
17
18
# File 'lib/pokan-cluster/autorunner.rb', line 16

def self.register_server(server_class)
  @server = server_class
end

.runObject

Calls the method ‘start` on every registered server



26
27
28
# File 'lib/pokan-cluster/autorunner.rb', line 26

def self.run
  @server.start(@options)
end

.run?Boolean

Checks if we have any server to start

Returns:

  • (Boolean)


21
22
23
# File 'lib/pokan-cluster/autorunner.rb', line 21

def self.run?
  @server.respond_to? :start
end