Class: WebSystem::ThinServerRack

Inherits:
ServerRack show all
Defined in:
lib/web_system/sub/rack/server_racks/thin_server_rack.rb

Defined Under Namespace

Classes: ThinHandler

Class Method Summary collapse

Methods inherited from Liza::Controller

color, inherited, on_connected

Methods inherited from Liza::Unit

const_missing, division, part, system, #system, test_class

Class Method Details

.call(rack_app) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/web_system/sub/rack/server_racks/thin_server_rack.rb', line 4

def self.call rack_app
  rack_panel = WebBox[:rack]

  host = rack_panel.get :host
  port = rack_panel.get :port
  files = rack_panel.get :files

  ::Object.const_set :Fixnum, Class.new(Integer) unless defined? Fixnum
  
  require "thin"
  require "thin/server"
  require "thin/logging"
  require "thin/backends/tcp_server"

  ::Rack::Handler.register :thin, ThinHandler

  # TODO: improve custom configurability for thin

  # https://github.com/macournoyer/thin/tree/master/example

  handler = ThinHandler
  handler.run rack_app, Host: host, Port: port
end