aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2012-12-28 09:57:47 -0800
committerSteve Klabnik <steve@steveklabnik.com>2012-12-28 09:57:47 -0800
commit90397de416bb4d9d852a1baa65f954c81bf9911a (patch)
tree599357bc10968eb886240b89590a9cad63bd3b7e
parentf75addd06bbdde925d095a4d27ddd6fbdd9336ba (diff)
parentf71aa354bee1909c8cd3e5872db90bc43d662b7f (diff)
downloadrails-90397de416bb4d9d852a1baa65f954c81bf9911a.tar.gz
rails-90397de416bb4d9d852a1baa65f954c81bf9911a.tar.bz2
rails-90397de416bb4d9d852a1baa65f954c81bf9911a.zip
Merge pull request #8641 from arunagw/warning_removed_unused_var
Remove 'assigned but unused variable' warning
-rw-r--r--activesupport/lib/active_support/core_ext/class/attribute.rb3
1 files changed, 2 insertions, 1 deletions
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 <tt>instance_accessor: false</tt>.
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