Class: Tinker::Application

Inherits:
Engine
  • Object
show all
Includes:
Reactor
Defined in:
lib/tinker/application.rb

Instance Attribute Summary

Attributes included from Reactor

#event_queue, #message_queue

Attributes inherited from Engine

#config

Instance Method Summary collapse

Methods included from Reactor

#clients, #run, #stop, #trap_sigint

Methods included from Evented

#dispatch, #every, #on

Methods inherited from Engine

configure, release_singleton

Methods included from Context

contexts, included

Constructor Details

#initializeApplication

Returns a new instance of Application.



7
8
9
10
# File 'lib/tinker/application.rb', line 7

def initialize
  super
  Tinker.application ||= self
end

Instance Method Details

#on_client_join(event) ⇒ Object



12
13
14
# File 'lib/tinker/application.rb', line 12

def on_client_join(event)
  add_client(event.environment.client)
end

#on_client_leave(event) ⇒ Object



16
17
18
# File 'lib/tinker/application.rb', line 16

def on_client_leave(event)
  event.environment.client.disconnect
end