Sha256: 72118217ee260a76a46bbc304be5c971f7107d71f518eb9fc3809767a223a6a3
Contents?: true
Size: 675 Bytes
Versions: 15
Compression:
Stored size: 675 Bytes
Contents
# frozen_string_literal: true module RSpecTracer module SourceFile PROJECT_ROOT_REGEX = Regexp.new("^#{Regexp.escape(RSpecTracer.root)}").freeze module_function def from_path(file_path) return unless File.file?(file_path) { file_path: file_path, file_name: file_name(file_path), digest: Digest::MD5.hexdigest(File.read(file_path)) } end def from_name(file_name) from_path(file_path(file_name)) end def file_name(file_path) file_path.sub(PROJECT_ROOT_REGEX, '') end def file_path(file_name) File.expand_path(file_name.sub(%r{^/}, ''), RSpecTracer.root) end end end
Version data entries
15 entries across 15 versions & 1 rubygems