From f71aa354bee1909c8cd3e5872db90bc43d662b7f Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Fri, 28 Dec 2012 23:14:59 +0530 Subject: Remove 'assigned but unused variable' warning --- activesupport/lib/active_support/core_ext/class/attribute.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb index 1504e18839..5d8d09aa69 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute.rb @@ -69,7 +69,8 @@ class Class # To opt out of both instance methods, pass instance_accessor: false. def class_attribute(*attrs) options = attrs.extract_options! - instance_reader = options.fetch(:instance_accessor, true) && options.fetch(:instance_reader, true) + # double assignment is used to avoid "assigned but unused variable" warning + instance_reader = instance_reader = options.fetch(:instance_accessor, true) && options.fetch(:instance_reader, true) instance_writer = options.fetch(:instance_accessor, true) && options.fetch(:instance_writer, true) # We use class_eval here rather than define_method because class_attribute -- cgit v1.2.3