Class: Tamashii::Server::Base

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



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

def initialize
  @mutex = Monitor.new
  mutex.synchronize { @instance ||= Rack.new(self, event_loop) }
end

Instance Attribute Details

#mutexObject (readonly)

Returns the value of attribute mutex.



7
8
9
# File 'lib/tamashii/server/base.rb', line 7

def mutex
  @mutex
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
# File 'lib/tamashii/server/base.rb', line 14

def call(env)
  @instance.call(env)
end

#event_loopObject



24
25
26
27
28
# File 'lib/tamashii/server/base.rb', line 24

def event_loop
  @event_loop || mutex.synchronize do
    @event_loop ||= Connection::StreamEventLoop.new
  end
end

#pubsubObject



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

def pubsub
  @pubsub || mutex.synchronize do
    @pubsub ||= Server.config.pubsub_class.new(self)
  end
end