Use frozen string literal in actioncable/

This commit is contained in:
Kir Shatrov 2017-07-16 20:10:15 +03:00
parent 68191d0f6e
commit 385825fb70
81 changed files with 159 additions and 1 deletions

@ -89,6 +89,7 @@ Style/FrozenStringLiteralComment:
Include:
- 'activesupport/**/*'
- 'activemodel/**/*'
- 'actioncable/**/*'
- 'activejob/**/*'
- 'activerecord/**/*'
- 'actionmailer/**/*'

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "rake/testtask"
require "pathname"
require "open3"

@ -1,3 +1,5 @@
# frozen_string_literal: true
version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip
Gem::Specification.new do |s|

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
COMPONENT_ROOT = File.expand_path("..", __dir__)
require_relative "../../tools/test"

@ -1,3 +1,5 @@
# frozen_string_literal: true
#--
# Copyright (c) 2015-2017 Basecamp, LLC
#

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Channel
extend ActiveSupport::Autoload

@ -270,7 +270,7 @@ def dispatch_action(action, data)
end
def action_signature(action, data)
"#{self.class.name}##{action}".tap do |signature|
"#{self.class.name}##{action}".dup.tap do |signature|
if (arguments = data.except("action")).any?
signature << "(#{arguments.inspect})"
end

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "active_support/core_ext/object/to_param"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "active_support/callbacks"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Channel
module Naming

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Channel
module PeriodicTimers

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Channel
# Streams allow channels to route broadcastings to the subscriber. A broadcasting is, as discussed elsewhere, a pubsub queue where any data

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Connection
extend ActiveSupport::Autoload

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Connection
module Authorization

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "action_dispatch"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "websocket/driver"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "set"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Connection
# Makes it possible for the RemoteConnection to disconnect a specific connection.

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Connection
# Allows us to buffer messages received from the WebSocket before the Connection has been fully initialized, and is ready to receive them.

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "thread"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "nio"
require "thread"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "active_support/core_ext/hash/indifferent_access"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Connection
# Allows the use of per-connection tags against the server logger. This wouldn't work using the traditional

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "websocket/driver"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "rails"
require "action_cable"
require_relative "helpers/action_cable_helper"

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
# Returns the version of the currently loaded Action Cable as a <tt>Gem::Version</tt>.
def self.gem_version

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Helpers
module ActionCableHelper

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
# If you need to disconnect a given connection, you can go through the
# RemoteConnections. You can find the connections you're looking for by

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Server
extend ActiveSupport::Autoload

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "monitor"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Server
# Broadcasting is how other parts of your application can send messages to a channel's subscribers. As explained in Channel, most of the time, these

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Server
# An instance of this configuration object is available via ActionCable.server.config, which allows you to tweak Action Cable configuration

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Server
# Collection class for all the connections that have been established on this specific server. Remember, usually you'll run many Action Cable servers, so

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "active_support/callbacks"
require "active_support/core_ext/module/attribute_accessors_per_thread"
require "concurrent"

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module Server
class Worker

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module SubscriptionAdapter
extend ActiveSupport::Autoload

@ -1,3 +1,5 @@
# frozen_string_literal: true
require_relative "inline"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module SubscriptionAdapter
class Base

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module SubscriptionAdapter
module ChannelPrefix # :nodoc:

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "thread"
gem "em-hiredis", "~> 0.3.0"

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module SubscriptionAdapter
class Inline < Base # :nodoc:

@ -1,3 +1,5 @@
# frozen_string_literal: true
gem "pg", "~> 0.18"
require "pg"
require "thread"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "thread"
gem "redis", "~> 3.0"

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActionCable
module SubscriptionAdapter
class SubscriberMap

@ -1,3 +1,5 @@
# frozen_string_literal: true
require_relative "gem_version"
module ActionCable

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Rails
module Generators
class ChannelGenerator < NamedBase

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_connection"
require "stubs/room"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_connection"
require "stubs/room"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
class ActionCable::Channel::NamingTest < ActiveSupport::TestCase

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_connection"
require "stubs/room"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_connection"
require "stubs/room"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_connection"
require "stubs/room"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "concurrent"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
require "active_support/core_ext/object/json"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
require "stubs/user"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
require "stubs/user"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
class ActionCable::Connection::SubscriptionsTest < ActionCable::TestCase

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
require "active_support/core_ext/hash/indifferent_access"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"

@ -1,3 +1,5 @@
# frozen_string_literal: true
class GlobalID
attr_reader :uri
delegate :to_param, :to_s, to: :uri

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Room
attr_reader :id, :name

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SuccessAdapter < ActionCable::SubscriptionAdapter::Base
def broadcast(channel, payload)
end

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "stubs/user"
class TestConnection

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "ostruct"
class TestServer

@ -1,3 +1,5 @@
# frozen_string_literal: true
class User
attr_reader :name

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require_relative "common"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
class ActionCable::Server::WithIndependentConfig < ActionCable::Server::Base

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require "concurrent"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require_relative "common"
require_relative "channel_prefix"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require_relative "common"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require_relative "common"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
require_relative "common"
require_relative "channel_prefix"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
class SubscriberMapTest < ActionCable::TestCase

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "action_cable"
require "active_support/testing/autorun"

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
class WorkerTest < ActiveSupport::TestCase