Sha256: dfa7d0980d7294185b128737e8e4587b56c33fd72e3235b8a37eee845c851a99
Contents?: true
Size: 500 Bytes
Versions: 5
Compression:
Stored size: 500 Bytes
Contents
module SubDiff class Gsub < Sub private def process(_builder, diff, _search) super last_prefix << prefix(diff) << diff[:match] end def last_prefix @last_prefix ||= '' end def prefix(_diff) super.sub(last_prefix, '') end def suffix(_diff, search) matcher = suffix_matcher(search) super unless super.send(matcher, search) end def suffix_matcher(search) search.is_a?(Regexp) ? :match : :include? end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
sub_diff-1.0.6 | lib/sub_diff/gsub.rb |
sub_diff-1.0.5 | lib/sub_diff/gsub.rb |
sub_diff-1.0.4 | lib/sub_diff/gsub.rb |
sub_diff-1.0.3 | lib/sub_diff/gsub.rb |
sub_diff-1.0.2 | lib/sub_diff/gsub.rb |