Permalink
Browse files

be explicit with module namespace

  • Loading branch information...
1 parent 517daf7 commit 9b41fb20cad673710d66793a1b06c8a801d67bf9 @stevegraham committed Apr 22, 2012
Showing with 27 additions and 25 deletions.
  1. +27 −25 lib/slanger/pusher_methods.rb
@@ -1,37 +1,39 @@
-module Slanger::PusherMethods
- def authenticate
- return establish if valid_app_key?
+module Slanger
+ module PusherMethods
+ def authenticate
+ return establish if valid_app_key?
- error({ code: '4001', message: "Could not find app by key #{app_key}" })
- @socket.close_websocket
- end
-
- def pusher_ping(msg)
- send_payload nil, 'pusher:ping'
- end
+ error({ code: '4001', message: "Could not find app by key #{app_key}" })
+ @socket.close_websocket
+ end
- def pusher_pong msg; end
+ def pusher_ping(msg)
+ send_payload nil, 'pusher:ping'
+ end
- def pusher_subscribe(msg)
- channel_id = msg['data']['channel']
+ def pusher_pong msg; end
- klass = subscription_klass channel_id
+ def pusher_subscribe(msg)
+ channel_id = msg['data']['channel']
- @subscriptions[channel_id] = klass.new(connection.socket,
- connection.socket_id, msg).subscribe
- end
+ klass = subscription_klass channel_id
- private
+ @subscriptions[channel_id] = klass.new(connection.socket,
+ connection.socket_id, msg).subscribe
+ end
- def valid_app_key?
- Slanger::Config.app_key == @socket.request['path'].split(/\W/)[2]
- end
+ private
- def subscription_klass channel_id
- klass = channel_id.match(/^(private|presence)-/) do |match|
- Slanger.const_get "#{match[1]}_subscription".classify
+ def valid_app_key?
+ Slanger::Config.app_key == @socket.request['path'].split(/\W/)[2]
end
- klass || Slanger::Subscription
+ def subscription_klass channel_id
+ klass = channel_id.match(/^(private|presence)-/) do |match|
+ Slanger.const_get "#{match[1]}_subscription".classify
+ end
+
+ klass || Slanger::Subscription
+ end
end
end

0 comments on commit 9b41fb2

Please sign in to comment.