summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chef/lib/chef/resource.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/chef/lib/chef/resource.rb b/chef/lib/chef/resource.rb
index 9b4cb36243..0ebf68c355 100644
--- a/chef/lib/chef/resource.rb
+++ b/chef/lib/chef/resource.rb
@@ -553,6 +553,10 @@ F
end
def defined_at
+ # The following regexp should match these two sourceline formats:
+ # /some/path/to/file.rb:80:in `wombat_tears'
+ # C:/some/path/to/file.rb:80 in 1`wombat_tears'
+ # extracting the path to the source file and the line number.
(file, line_no) = source_line.match(/(.*):(\d+):?.*$/).to_a[1,2] if source_line
if cookbook_name && recipe_name && source_line
"#{cookbook_name}::#{recipe_name} line #{line_no}"