Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

correct line numbers for reader and writer methods #6847

Merged
merged 1 commit into from

2 participants

@benolee

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).

I apologize in advance for the brevity of this commit -- I am submitting this from a phone using GitHub's "Edit this file" feature.

@carlosantoniodasilva carlosantoniodasilva merged commit df640f9 into from
@carlosantoniodasilva

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 24, 2012
  1. @benolee
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.