Class: Tamashii::Server::Base
- Inherits:
-
Object
- Object
- Tamashii::Server::Base
- Defined in:
- lib/tamashii/server/base.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#mutex ⇒ Object
readonly
Returns the value of attribute mutex.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #event_loop ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #pubsub ⇒ Object
Constructor Details
#initialize ⇒ Base
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
#mutex ⇒ Object (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_loop ⇒ Object
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 |
#pubsub ⇒ Object
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 |