module Cucumber::Core::Test::Location
Public Class Methods
from_file_colon_line(file_colon_line)
click to toggle source
# File lib/cucumber/core/test/location.rb, line 15 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)
click to toggle source
# File lib/cucumber/core/test/location.rb, line 20 def self.from_source_location(file, line) 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..-1] elsif file =~ /.*\/gems\/(.*\.rb)$/ file = $1 end new(file, line) end
new(file, raw_lines=nil)
click to toggle source
# File lib/cucumber/core/test/location.rb, line 32 def self.new(file, raw_lines=nil) file || raise(ArgumentError, "file is mandatory") if raw_lines Precise.new(file, Lines.new(raw_lines)) else Wildcard.new(file) end end
of_caller(additional_depth = 0)
click to toggle source
# File lib/cucumber/core/test/location.rb, line 11 def self.of_caller(additional_depth = 0) from_file_colon_line(*caller[1 + additional_depth]) end