Class: Primer::RealTime
- Inherits:
-
Faye::RackAdapter
- Object
- Faye::RackAdapter
- Primer::RealTime
- Defined in:
- lib/primer/real_time.rb
Defined Under Namespace
Classes: ClientAuth, ServerAuth
Constant Summary collapse
- BAYEUX_CONFIG =
{:mount => '/primer/bayeux', :timeout => 25}
- SCRIPT_PATH =
'/primer.js'
- TYPE_SCRIPT =
{'Content-Type' => 'text/javascript'}
- SCRIPT_SOURCE =
File.read(ROOT + '/javascript/primer.js')
Class Attribute Summary collapse
-
.bayeux_server ⇒ Object
Returns the value of attribute bayeux_server.
-
.password ⇒ Object
Returns the value of attribute password.
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RealTime
constructor
A new instance of RealTime.
Constructor Details
#initialize(app) ⇒ RealTime
Returns a new instance of RealTime.
36 37 38 39 |
# File 'lib/primer/real_time.rb', line 36 def initialize(app) super(app, BAYEUX_CONFIG) add_extension(ServerAuth.new) end |
Class Attribute Details
.bayeux_server ⇒ Object
Returns the value of attribute bayeux_server.
48 49 50 |
# File 'lib/primer/real_time.rb', line 48 def bayeux_server @bayeux_server end |
.password ⇒ Object
Returns the value of attribute password.
48 49 50 |
# File 'lib/primer/real_time.rb', line 48 def password @password end |
Class Method Details
.dom_id(cache_key) ⇒ Object
50 51 52 |
# File 'lib/primer/real_time.rb', line 50 def dom_id(cache_key) "primer#{ ('-' + cache_key).gsub(/[^a-z0-9]+/i, '-') }" end |
Instance Method Details
#call(env) ⇒ Object
41 42 43 44 45 |
# File 'lib/primer/real_time.rb', line 41 def call(env) request = Rack::Request.new(env) return super unless request.path_info == SCRIPT_PATH [200, TYPE_SCRIPT, [SCRIPT_SOURCE]] end |