Module: Cucumber::Core::Test::Location
- Defined in:
- lib/cucumber/core/test/location.rb
Defined Under Namespace
Classes: Lines, Precise, Wildcard
Class Method Summary
collapse
Class Method Details
.from_file_colon_line(file_colon_line) ⇒ Object
17
18
19
20
|
# File 'lib/cucumber/core/test/location.rb', line 17
def self.from_file_colon_line(file_colon_line)
file, raw_line = file_colon_line.match(/(.*):(\d+)/)[1..2]
from_source_location(file, raw_line.to_i)
end
|
.from_source_location(file, line, *_args) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/cucumber/core/test/location.rb', line 22
def self.from_source_location(file, line, *_args)
file = File.expand_path(file)
pwd = File.expand_path(Dir.pwd)
pwd.force_encoding(file.encoding)
if file.index(pwd)
file = file[(pwd.length + 1)..]
elsif file.match?(/gems\/(.+\.rb)$/)
file = file.split('gems/').last
end
new(file, line)
end
|
.new(file, raw_lines = nil) ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/cucumber/core/test/location.rb', line 34
def self.new(file, raw_lines = nil)
if raw_lines
Precise.new(file, Lines.new(raw_lines))
else
Wildcard.new(file)
end
end
|
.of_caller(additional_depth = 0) ⇒ Object
13
14
15
|
# File 'lib/cucumber/core/test/location.rb', line 13
def self.of_caller(additional_depth = 0)
from_file_colon_line(*caller[1 + additional_depth])
end
|