Module: Test::Unit

Defined in:
lib/test/unit/show_code.rb

Class Method Summary collapse

Class Method Details

._load_line(location) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/test/unit/show_code.rb', line 3

def _load_line(location)
  file, line = location.split(":", 2)
  line_no = line.to_i

  return nil unless File.exists?(file)
  return nil if line_no <= 0
  File.open(file) do |f|
    line = f.gets while f.lineno < line_no

    return line.strip
  end

  return nil
end