Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #6847 from benolee/patch-1

Correct line numbers for reader and writer methods in AS configurable

The line number for the reader method is off by one due to the local variable line being reassigned to the writer's line.

This commit would provide correct line numbers for backtraces and method introspection (for example, method(:reader).source_location).
  • Loading branch information...
commit df640f99dc24b01d61f9273d70f53a1d20cc9672 2 parents 8635f6a + 008023c
@carlosantoniodasilva carlosantoniodasilva authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 activesupport/lib/active_support/configurable.rb
View
12 activesupport/lib/active_support/configurable.rb
@@ -98,15 +98,15 @@ def config_accessor(*names)
names.each do |name|
raise NameError.new('invalid config attribute name') unless name =~ /^[_A-Za-z]\w*$/
- reader, line = "def #{name}; config.#{name}; end", __LINE__
- writer, line = "def #{name}=(value); config.#{name} = value; end", __LINE__
+ reader, reader_line = "def #{name}; config.#{name}; end", __LINE__
+ writer, writer_line = "def #{name}=(value); config.#{name} = value; end", __LINE__
- singleton_class.class_eval reader, __FILE__, line
- singleton_class.class_eval writer, __FILE__, line
+ singleton_class.class_eval reader, __FILE__, reader_line
+ singleton_class.class_eval writer, __FILE__, writer_line
unless options[:instance_accessor] == false
- class_eval reader, __FILE__, line unless options[:instance_reader] == false
- class_eval writer, __FILE__, line unless options[:instance_writer] == false
+ class_eval reader, __FILE__, reader_line unless options[:instance_reader] == false
+ class_eval writer, __FILE__, writer_line unless options[:instance_writer] == false
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.