mirror of
https://github.com/mistydemeo/tigerbrew.git
synced 2026-11-28 11:59:43 -05:00
Report correct file/line in backtraces for attr_rw methods
This commit is contained in:
1 parent
97ef699ecc
commit
735d91f43d
1 file changed
+4
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user