Class: Perus::Server::Server

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options_path = DEFAULT_SERVER_OPTIONS_PATH, environment = 'development') ⇒ Server

Returns a new instance of Server.



18
19
20
21
22
# File 'lib/perus/server/server.rb', line 18

def initialize(options_path = DEFAULT_SERVER_OPTIONS_PATH, environment = 'development')
    self.class.options.load(options_path, DEFAULT_SERVER_OPTIONS)
    ENV['RACK_ENV'] = environment
    DB.start
end

Class Method Details

.optionsObject



32
33
34
# File 'lib/perus/server/server.rb', line 32

def self.options
    @options ||= Perus::Options.new
end

Instance Method Details

#runObject



24
25
26
27
28
29
30
# File 'lib/perus/server/server.rb', line 24

def run
    Thin::Server.start(
        self.class.options.listen,
        self.class.options.port.to_i,
        App
    )
end