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)
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..] elsif file =~ /.*\/gems\/(.*\.rb)$/ file = $1 end new(file, line) end
def self.new(file, raw_lines = nil)
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
def self.of_caller(additional_depth = 0)
def self.of_caller(additional_depth = 0) from_file_colon_line(*caller[1 + additional_depth]) end