Sha256: caea5aaeb24f85309f6a35998b1d71585316e43bfc1435ebaa0c79aa2c3aa522
Contents?: true
Size: 861 Bytes
Versions: 5
Compression:
Stored size: 861 Bytes
Contents
# frozen_string_literal: true module Leftovers module MatcherBuilders module StringPattern def self.build(match: nil, has_prefix: nil, has_suffix: nil) # rubocop:disable Metrics has_prefix = ::Regexp.escape(has_prefix) if has_prefix has_suffix = ::Regexp.escape(has_suffix) if has_suffix if match && has_prefix && has_suffix /\A(?=#{match}\z)(?=#{has_prefix}).*#{has_suffix}\z/ elsif match && has_prefix /\A(?=#{match}\z)#{has_prefix}/ elsif match && has_suffix /\A(?=#{match}\z).*#{has_suffix}\z/ elsif match /\A#{match}\z/ elsif has_prefix && has_suffix /\A(?=#{has_prefix}).*#{has_suffix}\z/ elsif has_prefix /\A#{has_prefix}/ elsif has_suffix /#{has_suffix}\z/ end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems