aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-12-12 14:16:43 -0600
committerJack Nagel2013-12-12 14:20:46 -0600
commit735d91f43d3b1082effe4253300a1903e679f467 (patch)
tree2c9c980dcd280ac0ee0511e92cbbe97788d722c8
parent97ef699ecc8a6754f7f0d88fd3ac7ead09a5c13d (diff)
downloadhomebrew-735d91f43d3b1082effe4253300a1903e679f467.tar.bz2
Report correct file/line in backtraces for attr_rw methods
-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