summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Danna <steve@opscode.com>2013-01-22 10:13:07 -0800
committerSteven Danna <steve@opscode.com>2013-01-23 22:37:36 -0800
commitacfdee358457881ef83ba5a444e87251be92cd48 (patch)
tree97fd869da0f98c1f787f757c26df1af0c0bee3e9
parentf1d741c2767d5b9298e80027ddc477f176032b27 (diff)
downloadchef-ssd/CHEF-3068-rebased.tar.gz
[CHEF-3068] Add a comment explaining the intent of the regexp.ssd/CHEF-3068-rebased
-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}"