module Cucumber::Core::Test::Location
def self.from_file_colon_line(file_colon_line)
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
def self.from_source_location(file, line, *_args)
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
def self.new(file, raw_lines = nil)
def self.new(file, raw_lines = nil) if raw_lines Precise.new(file, Lines.new(raw_lines)) else Wildcard.new(file) end end
def self.of_caller(additional_depth = 0)
def self.of_caller(additional_depth = 0) from_file_colon_line(*caller[1 + additional_depth]) end