diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-05-29 18:01:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-29 18:01:50 +0200 |
commit | 1c275d812f35f53f93cd96184a4f319983766cc5 (patch) | |
tree | b063afeb12dd369f358ad18517e5e8915455df0e /actioncable/lib/action_cable | |
parent | edc90c858d4cbf1a8e4bfb7347b34348bb30e92c (diff) | |
download | rails-1c275d812f35f53f93cd96184a4f319983766cc5.tar.gz rails-1c275d812f35f53f93cd96184a4f319983766cc5.tar.bz2 rails-1c275d812f35f53f93cd96184a4f319983766cc5.zip |
Add option for class_attribute default (#29270)
* Allow a default value to be declared for class_attribute
* Convert to using class_attribute default rather than explicit setter
* Removed instance_accessor option by mistake
* False is a valid default value
* Documentation
Diffstat (limited to 'actioncable/lib/action_cable')
-rw-r--r-- | actioncable/lib/action_cable/channel/periodic_timers.rb | 3 | ||||
-rw-r--r-- | actioncable/lib/action_cable/connection/identification.rb | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/actioncable/lib/action_cable/channel/periodic_timers.rb b/actioncable/lib/action_cable/channel/periodic_timers.rb index c9daa0bcd3..90c68cfe84 100644 --- a/actioncable/lib/action_cable/channel/periodic_timers.rb +++ b/actioncable/lib/action_cable/channel/periodic_timers.rb @@ -4,8 +4,7 @@ module ActionCable extend ActiveSupport::Concern included do - class_attribute :periodic_timers, instance_reader: false - self.periodic_timers = [] + class_attribute :periodic_timers, instance_reader: false, default: [] after_subscribe :start_periodic_timers after_unsubscribe :stop_periodic_timers diff --git a/actioncable/lib/action_cable/connection/identification.rb b/actioncable/lib/action_cable/connection/identification.rb index c91a1d1fd7..ffab359429 100644 --- a/actioncable/lib/action_cable/connection/identification.rb +++ b/actioncable/lib/action_cable/connection/identification.rb @@ -6,8 +6,7 @@ module ActionCable extend ActiveSupport::Concern included do - class_attribute :identifiers - self.identifiers = Set.new + class_attribute :identifiers, default: Set.new end class_methods do |