Sha256: 41a661ca2de83ea0b94639a19a66790f783d9623105cb35c5055d7e27536fa86
Contents?: true
Size: 913 Bytes
Versions: 7
Compression:
Stored size: 913 Bytes
Contents
# frozen_string_literal: true class FastIgnore class FileRoot # :nocov: using ::FastIgnore::Backports::DeletePrefixSuffix if defined?(::FastIgnore::Backports::DeletePrefixSuffix) # :nocov: def self.build(file_path, project_root) file_root = "#{::File.dirname(file_path)}/".delete_prefix(project_root) new(file_root) unless file_root.empty? end def initialize(file_root) @file_root = file_root end def shebang_path_pattern @shebang_path_pattern ||= /\A#{escaped}./ end def escaped @escaped ||= ::Regexp.escape(@file_root) end def escaped_segments @escaped_segments ||= escaped.split('/') end def escaped_segments_length @escaped_segments_length ||= escaped_segments.length end def escaped_segments_joined @escaped_segments_joined ||= escaped_segments.join('(?:/') + '(?:/' end end end
Version data entries
7 entries across 7 versions & 1 rubygems