diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-06-22 16:13:09 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-06-22 16:13:09 +0200 |
commit | 05c3ba113c752c1aebc09260bd0ce36f9e3b722b (patch) | |
tree | 5d749f938581811ae654da62bb3df4761fe95615 | |
parent | a80c8c0e3943001e039e49f9aa91f55eeeb65f5a (diff) | |
download | rails-05c3ba113c752c1aebc09260bd0ce36f9e3b722b.tar.gz rails-05c3ba113c752c1aebc09260bd0ce36f9e3b722b.tar.bz2 rails-05c3ba113c752c1aebc09260bd0ce36f9e3b722b.zip |
Use private accessor
-rw-r--r-- | lib/action_cable/connection/base.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/action_cable/connection/base.rb b/lib/action_cable/connection/base.rb index 1548447d74..69102aeaa3 100644 --- a/lib/action_cable/connection/base.rb +++ b/lib/action_cable/connection/base.rb @@ -27,11 +27,11 @@ module ActionCable if websocket? @websocket = Faye::WebSocket.new(@env) - @websocket.on(:open) { |event| send_async :on_open } - @websocket.on(:message) { |event| on_message event.data } - @websocket.on(:close) { |event| send_async :on_close } - - @websocket.rack_response + websocket.on(:open) { |event| send_async :on_open } + websocket.on(:message) { |event| on_message event.data } + websocket.on(:close) { |event| send_async :on_close } + + websocket.rack_response else respond_to_invalid_request end @@ -54,12 +54,12 @@ module ActionCable end def transmit(data) - @websocket.send data + websocket.send data end def close logger.error "Closing connection" - @websocket.close + websocket.close end @@ -87,6 +87,7 @@ module ActionCable private + attr_reader :websocket attr_reader :heartbeat, :subscriptions, :message_buffer def on_open @@ -134,7 +135,7 @@ module ActionCable end def websocket_alive? - @websocket && @websocket.ready_state == Faye::WebSocket::API::OPEN + websocket && websocket.ready_state == Faye::WebSocket::API::OPEN end def websocket? |