Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Remove 'assigned but unused variable' warning #8641

Merged
merged 1 commit into from

2 participants

@arunagw
Collaborator

No description provided.

@steveklabnik steveklabnik merged commit 90397de into rails:master
@steveklabnik
Collaborator

Seems good, thank you for the comment especially! :heart:

@arunagw arunagw deleted the arunagw:warning_removed_unused_var branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 28, 2012
  1. @arunagw
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  activesupport/lib/active_support/core_ext/class/attribute.rb
View
3  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
Something went wrong with that request. Please try again.