Class: FayeRails::RackAdapter
- Inherits:
-
Faye::RackAdapter
- Object
- Faye::RackAdapter
- FayeRails::RackAdapter
- Defined in:
- lib/faye-rails/rack_adapter.rb
Defined Under Namespace
Classes: DebugMessagesExtension, RoutingExtension
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
-
#debug_messages ⇒ Object
Adds a very simple extension to the server causing it to log all messages in and out to Rails.logger.debug.
-
#initialize(app = nil, options = nil) ⇒ RackAdapter
constructor
A new instance of RackAdapter.
-
#map(opts) ⇒ Object
Rudimentary routing support for channels to controllers.
Constructor Details
#initialize(app = nil, options = nil) ⇒ RackAdapter
Returns a new instance of RackAdapter.
8 9 10 11 |
# File 'lib/faye-rails/rack_adapter.rb', line 8 def initialize(app=nil, =nil) super FayeRails.servers << self end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
6 7 8 |
# File 'lib/faye-rails/rack_adapter.rb', line 6 def endpoint @endpoint end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
6 7 8 |
# File 'lib/faye-rails/rack_adapter.rb', line 6 def server @server end |
Instance Method Details
#debug_messages ⇒ Object
Adds a very simple extension to the server causing it to log all messages in and out to Rails.logger.debug.
54 55 56 |
# File 'lib/faye-rails/rack_adapter.rb', line 54 def add_extension(DebugMessagesExtension.new) end |
#map(opts) ⇒ Object
Rudimentary routing support for channels to controllers.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/faye-rails/rack_adapter.rb', line 30 def map(opts) if opts.is_a? Hash opts.each do |channel, controller| if channel.is_a? String if FayeRails::Matcher.match? '/**', channel routing_extension.map(channel, controller) else raise ArgumentError, "Invalid channel: #{channel}" end elsif channel == :default if controller == :block routing_extension.block_unknown_channels! elsif controller == :drop routing_extension.drop_unknown_channels! elsif controller == :allow routing_extension.allow_unknown_channels! end end end end end |