Class: Proc
Overview
Proc extension to get more location info out of a proc
Constant Summary collapse
- PROC_PATTERN =
:nodoc:
/[\d\w]+@(.+):(\d+).*>/
- PWD =
Dir.pwd
Instance Method Summary collapse
Instance Method Details
#backtrace_line(name) ⇒ Object
10 11 12 |
# File 'lib/cucumber/core_ext/proc.rb', line 10 def backtrace_line(name) "#{file_colon_line}:in `#{name}'" end |
#file_colon_line ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cucumber/core_ext/proc.rb', line 15 def file_colon_line path, line = *to_s.match(PROC_PATTERN)[1..2] path = File.(path) pwd = File.(PWD) if path.index(pwd) path = path[pwd.length+1..-1] elsif path =~ /.*\/gems\/(.*\.rb)$/ path = $1 end "#{path}:#{line}" end |
#to_comment_line ⇒ Object
6 7 8 |
# File 'lib/cucumber/core_ext/proc.rb', line 6 def to_comment_line "# #{file_colon_line}" end |