summaryrefslogtreecommitdiff
path: root/lib/chef/mixin/callers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/mixin/callers.rb')
-rw-r--r--lib/chef/mixin/callers.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/chef/mixin/callers.rb b/lib/chef/mixin/callers.rb
new file mode 100644
index 0000000000..d6eea96780
--- /dev/null
+++ b/lib/chef/mixin/callers.rb
@@ -0,0 +1,14 @@
+class Chef
+ module Mixin
+ module Callers
+ def parse_caller(at)
+ if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
+ file = Regexp.last_match[1]
+ line = Regexp.last_match[2].to_i
+ method = Regexp.last_match[3]
+ [file, line, method]
+ end
+ end
+ end
+ end
+end