aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--actioncable/lib/action_cable.rb16
-rw-r--r--actioncable/lib/action_cable/channel/base.rb6
-rw-r--r--actioncable/lib/action_cable/channel/broadcasting.rb4
-rw-r--r--actioncable/lib/action_cable/channel/callbacks.rb2
-rw-r--r--actioncable/lib/action_cable/channel/naming.rb2
-rw-r--r--actioncable/lib/action_cable/channel/periodic_timers.rb2
-rw-r--r--actioncable/lib/action_cable/connection/base.rb16
-rw-r--r--actioncable/lib/action_cable/connection/client_socket.rb20
-rw-r--r--actioncable/lib/action_cable/connection/faye_client_socket.rb2
-rw-r--r--actioncable/lib/action_cable/connection/faye_event_loop.rb4
-rw-r--r--actioncable/lib/action_cable/connection/identification.rb2
-rw-r--r--actioncable/lib/action_cable/connection/internal_channel.rb4
-rw-r--r--actioncable/lib/action_cable/connection/stream.rb10
-rw-r--r--actioncable/lib/action_cable/connection/stream_event_loop.rb4
-rw-r--r--actioncable/lib/action_cable/connection/subscriptions.rb18
-rw-r--r--actioncable/lib/action_cable/connection/web_socket.rb2
-rw-r--r--actioncable/lib/action_cable/engine.rb2
-rw-r--r--actioncable/lib/action_cable/remote_connections.rb2
-rw-r--r--actioncable/lib/action_cable/server.rb2
-rw-r--r--actioncable/lib/action_cable/server/base.rb2
-rw-r--r--actioncable/lib/action_cable/server/configuration.rb4
-rw-r--r--actioncable/lib/action_cable/server/worker.rb6
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/async.rb2
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/evented_redis.rb10
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/postgresql.rb8
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/redis.rb14
-rw-r--r--actioncable/lib/action_cable/version.rb2
-rw-r--r--actioncable/lib/rails/generators/channel/channel_generator.rb12
28 files changed, 90 insertions, 90 deletions
diff --git a/actioncable/lib/action_cable.rb b/actioncable/lib/action_cable.rb
index b6d2842867..d353716636 100644
--- a/actioncable/lib/action_cable.rb
+++ b/actioncable/lib/action_cable.rb
@@ -21,21 +21,21 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-require 'active_support'
-require 'active_support/rails'
-require 'action_cable/version'
+require "active_support"
+require "active_support/rails"
+require "action_cable/version"
module ActionCable
extend ActiveSupport::Autoload
INTERNAL = {
message_types: {
- welcome: 'welcome'.freeze,
- ping: 'ping'.freeze,
- confirmation: 'confirm_subscription'.freeze,
- rejection: 'reject_subscription'.freeze
+ welcome: "welcome".freeze,
+ ping: "ping".freeze,
+ confirmation: "confirm_subscription".freeze,
+ rejection: "reject_subscription".freeze
},
- default_mount_path: '/cable'.freeze,
+ default_mount_path: "/cable".freeze,
protocols: ["actioncable-v1-json".freeze, "actioncable-unsupported".freeze].freeze
}
diff --git a/actioncable/lib/action_cable/channel/base.rb b/actioncable/lib/action_cable/channel/base.rb
index 845b747fc5..1dda0e407f 100644
--- a/actioncable/lib/action_cable/channel/base.rb
+++ b/actioncable/lib/action_cable/channel/base.rb
@@ -1,4 +1,4 @@
-require 'set'
+require "set"
module ActionCable
module Channel
@@ -244,7 +244,7 @@ module ActionCable
end
def extract_action(data)
- (data['action'].presence || :receive).to_sym
+ (data["action"].presence || :receive).to_sym
end
def processable_action?(action)
@@ -263,7 +263,7 @@ module ActionCable
def action_signature(action, data)
"#{self.class.name}##{action}".tap do |signature|
- if (arguments = data.except('action')).any?
+ if (arguments = data.except("action")).any?
signature << "(#{arguments.inspect})"
end
end
diff --git a/actioncable/lib/action_cable/channel/broadcasting.rb b/actioncable/lib/action_cable/channel/broadcasting.rb
index afc23d7d1a..23ed4ec943 100644
--- a/actioncable/lib/action_cable/channel/broadcasting.rb
+++ b/actioncable/lib/action_cable/channel/broadcasting.rb
@@ -1,4 +1,4 @@
-require 'active_support/core_ext/object/to_param'
+require "active_support/core_ext/object/to_param"
module ActionCable
module Channel
@@ -16,7 +16,7 @@ module ActionCable
def broadcasting_for(model) #:nodoc:
case
when model.is_a?(Array)
- model.map { |m| broadcasting_for(m) }.join(':')
+ model.map { |m| broadcasting_for(m) }.join(":")
when model.respond_to?(:to_gid_param)
model.to_gid_param
else
diff --git a/actioncable/lib/action_cable/channel/callbacks.rb b/actioncable/lib/action_cable/channel/callbacks.rb
index 295d750e86..c740132c94 100644
--- a/actioncable/lib/action_cable/channel/callbacks.rb
+++ b/actioncable/lib/action_cable/channel/callbacks.rb
@@ -1,4 +1,4 @@
-require 'active_support/callbacks'
+require "active_support/callbacks"
module ActionCable
module Channel
diff --git a/actioncable/lib/action_cable/channel/naming.rb b/actioncable/lib/action_cable/channel/naming.rb
index 8e1b2a4af0..b7e88bf73d 100644
--- a/actioncable/lib/action_cable/channel/naming.rb
+++ b/actioncable/lib/action_cable/channel/naming.rb
@@ -12,7 +12,7 @@ module ActionCable
# Chats::AppearancesChannel.channel_name # => 'chats:appearances'
# FooChats::BarAppearancesChannel.channel_name # => 'foo_chats:bar_appearances'
def channel_name
- @channel_name ||= name.sub(/Channel$/, '').gsub('::',':').underscore
+ @channel_name ||= name.sub(/Channel$/, "").gsub("::",":").underscore
end
end
diff --git a/actioncable/lib/action_cable/channel/periodic_timers.rb b/actioncable/lib/action_cable/channel/periodic_timers.rb
index 41511312fc..c9daa0bcd3 100644
--- a/actioncable/lib/action_cable/channel/periodic_timers.rb
+++ b/actioncable/lib/action_cable/channel/periodic_timers.rb
@@ -30,7 +30,7 @@ module ActionCable
def periodically(callback_or_method_name = nil, every:, &block)
callback =
if block_given?
- raise ArgumentError, 'Pass a block or provide a callback arg, not both' if callback_or_method_name
+ raise ArgumentError, "Pass a block or provide a callback arg, not both" if callback_or_method_name
block
else
case callback_or_method_name
diff --git a/actioncable/lib/action_cable/connection/base.rb b/actioncable/lib/action_cable/connection/base.rb
index 75c1299e36..b0615b08a1 100644
--- a/actioncable/lib/action_cable/connection/base.rb
+++ b/actioncable/lib/action_cable/connection/base.rb
@@ -1,4 +1,4 @@
-require 'action_dispatch'
+require "action_dispatch"
module ActionCable
module Connection
@@ -112,7 +112,7 @@ module ActionCable
identifier: connection_identifier,
started_at: @started_at,
subscriptions: subscriptions.identifiers,
- request_id: @env['action_dispatch.request_id']
+ request_id: @env["action_dispatch.request_id"]
}
end
@@ -195,7 +195,7 @@ module ActionCable
def allow_request_origin?
return true if server.config.disable_request_forgery_protection
- if Array(server.config.allowed_request_origins).any? { |allowed_origin| allowed_origin === env['HTTP_ORIGIN'] }
+ if Array(server.config.allowed_request_origins).any? { |allowed_origin| allowed_origin === env["HTTP_ORIGIN"] }
true
else
logger.error("Request origin not allowed: #{env['HTTP_ORIGIN']}")
@@ -213,7 +213,7 @@ module ActionCable
logger.error invalid_request_message
logger.info finished_request_message
- [ 404, { 'Content-Type' => 'text/plain' }, [ 'Page not found' ] ]
+ [ 404, { "Content-Type" => "text/plain" }, [ "Page not found" ] ]
end
# Tags are declared in the server but computed in the connection. This allows us per-connection tailored tags.
@@ -226,7 +226,7 @@ module ActionCable
'Started %s "%s"%s for %s at %s' % [
request.request_method,
request.filtered_path,
- websocket.possible? ? ' [WebSocket]' : '[non-WebSocket]',
+ websocket.possible? ? " [WebSocket]" : "[non-WebSocket]",
request.ip,
Time.now.to_s ]
end
@@ -234,19 +234,19 @@ module ActionCable
def finished_request_message
'Finished "%s"%s for %s at %s' % [
request.filtered_path,
- websocket.possible? ? ' [WebSocket]' : '[non-WebSocket]',
+ websocket.possible? ? " [WebSocket]" : "[non-WebSocket]",
request.ip,
Time.now.to_s ]
end
def invalid_request_message
- 'Failed to upgrade to WebSocket (REQUEST_METHOD: %s, HTTP_CONNECTION: %s, HTTP_UPGRADE: %s)' % [
+ "Failed to upgrade to WebSocket (REQUEST_METHOD: %s, HTTP_CONNECTION: %s, HTTP_UPGRADE: %s)" % [
env["REQUEST_METHOD"], env["HTTP_CONNECTION"], env["HTTP_UPGRADE"]
]
end
def successful_request_message
- 'Successfully upgraded to WebSocket (REQUEST_METHOD: %s, HTTP_CONNECTION: %s, HTTP_UPGRADE: %s)' % [
+ "Successfully upgraded to WebSocket (REQUEST_METHOD: %s, HTTP_CONNECTION: %s, HTTP_UPGRADE: %s)" % [
env["REQUEST_METHOD"], env["HTTP_CONNECTION"], env["HTTP_UPGRADE"]
]
end
diff --git a/actioncable/lib/action_cable/connection/client_socket.rb b/actioncable/lib/action_cable/connection/client_socket.rb
index 6f29f32ea9..d573a68f70 100644
--- a/actioncable/lib/action_cable/connection/client_socket.rb
+++ b/actioncable/lib/action_cable/connection/client_socket.rb
@@ -1,4 +1,4 @@
-require 'websocket/driver'
+require "websocket/driver"
module ActionCable
module Connection
@@ -8,16 +8,16 @@ module ActionCable
# Copyright (c) 2010-2015 James Coglan
class ClientSocket # :nodoc:
def self.determine_url(env)
- scheme = secure_request?(env) ? 'wss:' : 'ws:'
+ scheme = secure_request?(env) ? "wss:" : "ws:"
"#{ scheme }//#{ env['HTTP_HOST'] }#{ env['REQUEST_URI'] }"
end
def self.secure_request?(env)
- return true if env['HTTPS'] == 'on'
- return true if env['HTTP_X_FORWARDED_SSL'] == 'on'
- return true if env['HTTP_X_FORWARDED_SCHEME'] == 'https'
- return true if env['HTTP_X_FORWARDED_PROTO'] == 'https'
- return true if env['rack.url_scheme'] == 'https'
+ return true if env["HTTPS"] == "on"
+ return true if env["HTTP_X_FORWARDED_SSL"] == "on"
+ return true if env["HTTP_X_FORWARDED_SCHEME"] == "https"
+ return true if env["HTTP_X_FORWARDED_PROTO"] == "https"
+ return true if env["rack.url_scheme"] == "https"
return false
end
@@ -37,7 +37,7 @@ module ActionCable
@url = ClientSocket.determine_url(@env)
@driver = @driver_started = nil
- @close_params = ['', 1006]
+ @close_params = ["", 1006]
@ready_state = CONNECTING
@@ -56,7 +56,7 @@ module ActionCable
return if @driver.nil? || @driver_started
@stream.hijack_rack_socket
- if callback = @env['async.callback']
+ if callback = @env["async.callback"]
callback.call([101, {}, @stream])
end
@@ -87,7 +87,7 @@ module ActionCable
def close(code = nil, reason = nil)
code ||= 1000
- reason ||= ''
+ reason ||= ""
unless code == 1000 or (code >= 3000 and code <= 4999)
raise ArgumentError, "Failed to execute 'close' on WebSocket: " +
diff --git a/actioncable/lib/action_cable/connection/faye_client_socket.rb b/actioncable/lib/action_cable/connection/faye_client_socket.rb
index a4bfe7db17..06e92c5d52 100644
--- a/actioncable/lib/action_cable/connection/faye_client_socket.rb
+++ b/actioncable/lib/action_cable/connection/faye_client_socket.rb
@@ -1,4 +1,4 @@
-require 'faye/websocket'
+require "faye/websocket"
module ActionCable
module Connection
diff --git a/actioncable/lib/action_cable/connection/faye_event_loop.rb b/actioncable/lib/action_cable/connection/faye_event_loop.rb
index 9c44b38bc3..cfbe26ee6a 100644
--- a/actioncable/lib/action_cable/connection/faye_event_loop.rb
+++ b/actioncable/lib/action_cable/connection/faye_event_loop.rb
@@ -1,6 +1,6 @@
-require 'thread'
+require "thread"
-require 'eventmachine'
+require "eventmachine"
EventMachine.epoll if EventMachine.epoll?
EventMachine.kqueue if EventMachine.kqueue?
diff --git a/actioncable/lib/action_cable/connection/identification.rb b/actioncable/lib/action_cable/connection/identification.rb
index 4a54044aff..c91a1d1fd7 100644
--- a/actioncable/lib/action_cable/connection/identification.rb
+++ b/actioncable/lib/action_cable/connection/identification.rb
@@ -1,4 +1,4 @@
-require 'set'
+require "set"
module ActionCable
module Connection
diff --git a/actioncable/lib/action_cable/connection/internal_channel.rb b/actioncable/lib/action_cable/connection/internal_channel.rb
index f70d52f99b..8f0ec766c3 100644
--- a/actioncable/lib/action_cable/connection/internal_channel.rb
+++ b/actioncable/lib/action_cable/connection/internal_channel.rb
@@ -27,8 +27,8 @@ module ActionCable
end
def process_internal_message(message)
- case message['type']
- when 'disconnect'
+ case message["type"]
+ when "disconnect"
logger.info "Removing connection (#{connection_identifier})"
websocket.close
end
diff --git a/actioncable/lib/action_cable/connection/stream.rb b/actioncable/lib/action_cable/connection/stream.rb
index 5695623859..5a2aace0ba 100644
--- a/actioncable/lib/action_cable/connection/stream.rb
+++ b/actioncable/lib/action_cable/connection/stream.rb
@@ -1,4 +1,4 @@
-require 'thread'
+require "thread"
module ActionCable
module Connection
@@ -10,7 +10,7 @@ module ActionCable
def initialize(event_loop, socket)
@event_loop = event_loop
@socket_object = socket
- @stream_send = socket.env['stream.send']
+ @stream_send = socket.env["stream.send"]
@rack_hijack_io = nil
@write_lock = Mutex.new
@@ -43,10 +43,10 @@ module ActionCable
end
def hijack_rack_socket
- return unless @socket_object.env['rack.hijack']
+ return unless @socket_object.env["rack.hijack"]
- @socket_object.env['rack.hijack'].call
- @rack_hijack_io = @socket_object.env['rack.hijack_io']
+ @socket_object.env["rack.hijack"].call
+ @rack_hijack_io = @socket_object.env["rack.hijack_io"]
@event_loop.attach(@rack_hijack_io, self)
end
diff --git a/actioncable/lib/action_cable/connection/stream_event_loop.rb b/actioncable/lib/action_cable/connection/stream_event_loop.rb
index 2abad09c03..106b948c45 100644
--- a/actioncable/lib/action_cable/connection/stream_event_loop.rb
+++ b/actioncable/lib/action_cable/connection/stream_event_loop.rb
@@ -1,5 +1,5 @@
-require 'nio'
-require 'thread'
+require "nio"
+require "thread"
module ActionCable
module Connection
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']}"
diff --git a/actioncable/lib/action_cable/connection/web_socket.rb b/actioncable/lib/action_cable/connection/web_socket.rb
index 11f28c37e8..52d8daad4b 100644
--- a/actioncable/lib/action_cable/connection/web_socket.rb
+++ b/actioncable/lib/action_cable/connection/web_socket.rb
@@ -1,4 +1,4 @@
-require 'websocket/driver'
+require "websocket/driver"
module ActionCable
module Connection
diff --git a/actioncable/lib/action_cable/engine.rb b/actioncable/lib/action_cable/engine.rb
index 34f9952c71..4c5c975cd8 100644
--- a/actioncable/lib/action_cable/engine.rb
+++ b/actioncable/lib/action_cable/engine.rb
@@ -32,7 +32,7 @@ module ActionCable
end
previous_connection_class = self.connection_class
- self.connection_class = -> { 'ApplicationCable::Connection'.safe_constantize || previous_connection_class.call }
+ self.connection_class = -> { "ApplicationCable::Connection".safe_constantize || previous_connection_class.call }
options.each { |k,v| send("#{k}=", v) }
end
diff --git a/actioncable/lib/action_cable/remote_connections.rb b/actioncable/lib/action_cable/remote_connections.rb
index a528024427..720ba52d19 100644
--- a/actioncable/lib/action_cable/remote_connections.rb
+++ b/actioncable/lib/action_cable/remote_connections.rb
@@ -41,7 +41,7 @@ module ActionCable
# Uses the internal channel to disconnect the connection.
def disconnect
- server.broadcast internal_channel, type: 'disconnect'
+ server.broadcast internal_channel, type: "disconnect"
end
# Returns all the identifiers that were applied to this connection.
diff --git a/actioncable/lib/action_cable/server.rb b/actioncable/lib/action_cable/server.rb
index bd6a3826a3..22f9353825 100644
--- a/actioncable/lib/action_cable/server.rb
+++ b/actioncable/lib/action_cable/server.rb
@@ -9,7 +9,7 @@ module ActionCable
autoload :Configuration
autoload :Worker
- autoload :ActiveRecordConnectionManagement, 'action_cable/server/worker/active_record_connection_management'
+ autoload :ActiveRecordConnectionManagement, "action_cable/server/worker/active_record_connection_management"
end
end
end
diff --git a/actioncable/lib/action_cable/server/base.rb b/actioncable/lib/action_cable/server/base.rb
index 0ad1e408a9..c700297a8d 100644
--- a/actioncable/lib/action_cable/server/base.rb
+++ b/actioncable/lib/action_cable/server/base.rb
@@ -1,4 +1,4 @@
-require 'monitor'
+require "monitor"
module ActionCable
module Server
diff --git a/actioncable/lib/action_cable/server/configuration.rb b/actioncable/lib/action_cable/server/configuration.rb
index ada1ac22cc..7153593d4c 100644
--- a/actioncable/lib/action_cable/server/configuration.rb
+++ b/actioncable/lib/action_cable/server/configuration.rb
@@ -21,7 +21,7 @@ module ActionCable
# If the adapter cannot be found, this will default to the Redis adapter.
# Also makes sure proper dependencies are required.
def pubsub_adapter
- adapter = (cable.fetch('adapter') { 'redis' })
+ adapter = (cable.fetch("adapter") { "redis" })
path_to_adapter = "action_cable/subscription_adapter/#{adapter}"
begin
require path_to_adapter
@@ -32,7 +32,7 @@ module ActionCable
end
adapter = adapter.camelize
- adapter = 'PostgreSQL' if adapter == 'Postgresql'
+ adapter = "PostgreSQL" if adapter == "Postgresql"
"ActionCable::SubscriptionAdapter::#{adapter}".constantize
end
diff --git a/actioncable/lib/action_cable/server/worker.rb b/actioncable/lib/action_cable/server/worker.rb
index f3a4fc5a5b..7460472551 100644
--- a/actioncable/lib/action_cable/server/worker.rb
+++ b/actioncable/lib/action_cable/server/worker.rb
@@ -1,6 +1,6 @@
-require 'active_support/callbacks'
-require 'active_support/core_ext/module/attribute_accessors_per_thread'
-require 'concurrent'
+require "active_support/callbacks"
+require "active_support/core_ext/module/attribute_accessors_per_thread"
+require "concurrent"
module ActionCable
module Server
diff --git a/actioncable/lib/action_cable/subscription_adapter/async.rb b/actioncable/lib/action_cable/subscription_adapter/async.rb
index 10b3ac8cd8..46819dbfec 100644
--- a/actioncable/lib/action_cable/subscription_adapter/async.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/async.rb
@@ -1,4 +1,4 @@
-require 'action_cable/subscription_adapter/inline'
+require "action_cable/subscription_adapter/inline"
module ActionCable
module SubscriptionAdapter
diff --git a/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb b/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb
index 4735a4bfa8..bcd46d2a0e 100644
--- a/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb
@@ -1,9 +1,9 @@
-require 'thread'
+require "thread"
-gem 'em-hiredis', '~> 0.3.0'
-gem 'redis', '~> 3.0'
-require 'em-hiredis'
-require 'redis'
+gem "em-hiredis", "~> 0.3.0"
+gem "redis", "~> 3.0"
+require "em-hiredis"
+require "redis"
EventMachine.epoll if EventMachine.epoll?
EventMachine.kqueue if EventMachine.kqueue?
diff --git a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb
index 66c7852f6e..2637bfbea3 100644
--- a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb
@@ -1,6 +1,6 @@
-gem 'pg', '~> 0.18'
-require 'pg'
-require 'thread'
+gem "pg", "~> 0.18"
+require "pg"
+require "thread"
module ActionCable
module SubscriptionAdapter
@@ -33,7 +33,7 @@ module ActionCable
pg_conn = ar_conn.raw_connection
unless pg_conn.is_a?(PG::Connection)
- raise 'ActiveRecord database must be Postgres in order to use the Postgres ActionCable storage adapter'
+ raise "ActiveRecord database must be Postgres in order to use the Postgres ActionCable storage adapter"
end
yield pg_conn
diff --git a/actioncable/lib/action_cable/subscription_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb
index 65434f7107..62bd284a6b 100644
--- a/actioncable/lib/action_cable/subscription_adapter/redis.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb
@@ -1,7 +1,7 @@
-require 'thread'
+require "thread"
-gem 'redis', '~> 3.0'
-require 'redis'
+gem "redis", "~> 3.0"
+require "redis"
module ActionCable
module SubscriptionAdapter
@@ -72,7 +72,7 @@ module ActionCable
conn.without_reconnect do
original_client = conn.client
- conn.subscribe('_action_cable_internal') do |on|
+ conn.subscribe("_action_cable_internal") do |on|
on.subscribe do |chan, count|
@subscription_lock.synchronize do
if count == 1
@@ -111,7 +111,7 @@ module ActionCable
return if @thread.nil?
when_connected do
- send_command('unsubscribe')
+ send_command("unsubscribe")
@raw_client = nil
end
end
@@ -123,13 +123,13 @@ module ActionCable
@subscription_lock.synchronize do
ensure_listener_running
@subscribe_callbacks[channel] << on_success
- when_connected { send_command('subscribe', channel) }
+ when_connected { send_command("subscribe", channel) }
end
end
def remove_channel(channel)
@subscription_lock.synchronize do
- when_connected { send_command('unsubscribe', channel) }
+ when_connected { send_command("unsubscribe", channel) }
end
end
diff --git a/actioncable/lib/action_cable/version.rb b/actioncable/lib/action_cable/version.rb
index e17877202b..d6081409f0 100644
--- a/actioncable/lib/action_cable/version.rb
+++ b/actioncable/lib/action_cable/version.rb
@@ -1,4 +1,4 @@
-require_relative 'gem_version'
+require_relative "gem_version"
module ActionCable
# Returns the version of the currently loaded Action Cable as a <tt>Gem::Version</tt>
diff --git a/actioncable/lib/rails/generators/channel/channel_generator.rb b/actioncable/lib/rails/generators/channel/channel_generator.rb
index 47232252e3..20d807c033 100644
--- a/actioncable/lib/rails/generators/channel/channel_generator.rb
+++ b/actioncable/lib/rails/generators/channel/channel_generator.rb
@@ -10,14 +10,14 @@ module Rails
check_class_collision suffix: "Channel"
def create_channel_file
- template "channel.rb", File.join('app/channels', class_path, "#{file_name}_channel.rb")
+ template "channel.rb", File.join("app/channels", class_path, "#{file_name}_channel.rb")
if options[:assets]
if self.behavior == :invoke
template "assets/cable.js", "app/assets/javascripts/cable.js"
end
- js_template "assets/channel", File.join('app/assets/javascripts/channels', class_path, "#{file_name}")
+ js_template "assets/channel", File.join("app/assets/javascripts/channels", class_path, "#{file_name}")
end
generate_application_cable_files
@@ -25,7 +25,7 @@ module Rails
protected
def file_name
- @_file_name ||= super.gsub(/_channel/i, '')
+ @_file_name ||= super.gsub(/_channel/i, "")
end
# FIXME: Change these files to symlinks once RubyGems 2.5.0 is required.
@@ -33,12 +33,12 @@ module Rails
return if self.behavior != :invoke
files = [
- 'application_cable/channel.rb',
- 'application_cable/connection.rb'
+ "application_cable/channel.rb",
+ "application_cable/connection.rb"
]
files.each do |name|
- path = File.join('app/channels/', name)
+ path = File.join("app/channels/", name)
template(name, path) if !File.exist?(path)
end
end