aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Agrawal <arunagw@gmail.com>2012-12-28 23:14:59 +0530
committerArun Agrawal <arunagw@gmail.com>2012-12-28 23:14:59 +0530
commitf71aa354bee1909c8cd3e5872db90bc43d662b7f (patch)
tree357715e0cf715dff275eda7815e5b7c98e205cc1
parent6b18a79abe03046e5f572df26fc201958d5b2d0b (diff)
downloadrails-f71aa354bee1909c8cd3e5872db90bc43d662b7f.tar.gz
rails-f71aa354bee1909c8cd3e5872db90bc43d662b7f.tar.bz2
rails-f71aa354bee1909c8cd3e5872db90bc43d662b7f.zip
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