Class: Rubko

Inherits:
Object
  • Object
show all
Defined in:
lib/rubko.rb,
lib/rubko/base.rb

Defined Under Namespace

Modules: Base Classes: App, Asset, Controller, Model, Plugin, Socket, Storage

Constant Summary collapse

VERSION =
'0.2'

Instance Method Summary collapse

Constructor Details

#initialize(shared = {}) ⇒ Rubko

Returns a new instance of Rubko.



6
7
8
9
10
11
12
13
# File 'lib/rubko.rb', line 6

def initialize(shared = {})
	@shared = shared

	Dir['./includes/**/*.rb'].each { |file|
		require file
	}
	puts 'Server started successfully.'
end

Instance Method Details

#call(env) ⇒ Object



27
28
29
30
31
# File 'lib/rubko.rb', line 27

def call(env)
	abort if env['rack.multithread']
	app = Rubko::App.new env, @shared
	app.init env['REQUEST_URI'].encode 'utf-8'
end

#threadedObject

do not USE !



16
17
18
19
20
21
22
23
24
25
# File 'lib/rubko.rb', line 16

def threaded
	EM.threadpool_size = 50
	-> env {
		EM.defer(
			-> { call env },
			-> r { env['async.callback'].call r }
		)
		throw :async
	}
end