Method: Chef::Resource#defined_at

Defined in:
lib/chef/resource.rb

#defined_atObject



1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
# File 'lib/chef/resource.rb', line 1437

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.
  if cookbook_name && recipe_name && source_line
    "#{cookbook_name}::#{recipe_name} line #{source_line_number}"
  elsif source_line
    "#{source_line_file} line #{source_line_number}"
  else
    "dynamically defined"
  end
end