Report correct file/line in backtraces for attr_rw methods

This commit is contained in:
Jack Nagel committed 2013-12-12 14:20:46 -06:00
1 parent 97ef699ecc
commit 735d91f43d
1 file changed
+4 -1
+4 -1
View File
@@ -1,7 +1,10 @@
class Module
def attr_rw(*attrs)
file, line, _ = caller.first.split(":")
line = line.to_i
attrs.each do |attr|
module_eval <<-EOS, __FILE__, __LINE__ + 1
module_eval <<-EOS, file, line
def #{attr}(val=nil)
val.nil? ? @#{attr} : @#{attr} = val
end