Report correct file/line in backtraces for attr_rw methods
This commit is contained in:
parent
c0d199759f
commit
00d0de5b24
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user