aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/connection/subscriptions.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-08-06 19:13:46 +0200
committerXavier Noria <fxn@hashref.com>2016-08-06 19:13:46 +0200
commitb678eb57e93423ac8e2a0cc0b083ce556c6fb130 (patch)
tree7cba336a3a15179b3b549c34a4b0d0e2474f62cd /actioncable/lib/action_cable/connection/subscriptions.rb
parentb91ff557ef6f621d1b921f358fd5b8a5d9e9090e (diff)
downloadrails-b678eb57e93423ac8e2a0cc0b083ce556c6fb130.tar.gz
rails-b678eb57e93423ac8e2a0cc0b083ce556c6fb130.tar.bz2
rails-b678eb57e93423ac8e2a0cc0b083ce556c6fb130.zip
applies new string literal convention in actioncable/lib
The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
Diffstat (limited to 'actioncable/lib/action_cable/connection/subscriptions.rb')
-rw-r--r--actioncable/lib/action_cable/connection/subscriptions.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/actioncable/lib/action_cable/connection/subscriptions.rb b/actioncable/lib/action_cable/connection/subscriptions.rb
index 6051818bfb..9060183249 100644
--- a/actioncable/lib/action_cable/connection/subscriptions.rb
+++ b/actioncable/lib/action_cable/connection/subscriptions.rb
@@ -1,4 +1,4 @@
-require 'active_support/core_ext/hash/indifferent_access'
+require "active_support/core_ext/hash/indifferent_access"
module ActionCable
module Connection
@@ -11,10 +11,10 @@ module ActionCable
end
def execute_command(data)
- case data['command']
- when 'subscribe' then add data
- when 'unsubscribe' then remove data
- when 'message' then perform_action data
+ case data["command"]
+ when "subscribe" then add data
+ when "unsubscribe" then remove data
+ when "message" then perform_action data
else
logger.error "Received unrecognized command in #{data.inspect}"
end
@@ -23,7 +23,7 @@ module ActionCable
end
def add(data)
- id_key = data['identifier']
+ id_key = data["identifier"]
id_options = ActiveSupport::JSON.decode(id_key).with_indifferent_access
subscription_klass = id_options[:channel].safe_constantize
@@ -37,7 +37,7 @@ module ActionCable
def remove(data)
logger.info "Unsubscribing from channel: #{data['identifier']}"
- remove_subscription subscriptions[data['identifier']]
+ remove_subscription subscriptions[data["identifier"]]
end
def remove_subscription(subscription)
@@ -46,7 +46,7 @@ module ActionCable
end
def perform_action(data)
- find(data).perform_action ActiveSupport::JSON.decode(data['data'])
+ find(data).perform_action ActiveSupport::JSON.decode(data["data"])
end
def identifiers
@@ -64,7 +64,7 @@ module ActionCable
delegate :logger, to: :connection
def find(data)
- if subscription = subscriptions[data['identifier']]
+ if subscription = subscriptions[data["identifier"]]
subscription
else
raise "Unable to find subscription with identifier: #{data['identifier']}"