From 1c275d812f35f53f93cd96184a4f319983766cc5 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 29 May 2017 18:01:50 +0200 Subject: 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 --- actioncable/lib/action_cable/channel/periodic_timers.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'actioncable/lib/action_cable/channel') 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 -- cgit v1.2.3