aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-12-12 14:16:43 -0600
committerJack Nagel2013-12-12 14:20:46 -0600
commit00d0de5b240571118e41360a615776a172094f2f (patch)
tree6b8b7c2790ddebed6c38dd44328eee16611e8b1b /Library
parentc0d199759fd73014c8fc36f6116a8d36a2a95a81 (diff)
downloadbrew-00d0de5b240571118e41360a615776a172094f2f.tar.bz2
Report correct file/line in backtraces for attr_rw methods
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/module.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/Library/Homebrew/extend/module.rb b/Library/Homebrew/extend/module.rb
index 9210793f6..045508fd1 100644
--- a/Library/Homebrew/extend/module.rb
+++ b/Library/Homebrew/extend/module.rb
@@ -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