Sha256: e4006347f59d37c0d7576b9eb1537b86d7c70f2c04865fac594ad7f55c72a2b0
Contents?: true
Size: 522 Bytes
Versions: 2
Compression:
Stored size: 522 Bytes
Contents
require 'sub_diff/sub' module SubDiff class Gsub < Sub private def diff!(_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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sub_diff-1.0.1 | lib/sub_diff/gsub.rb |
sub_diff-1.0.0 | lib/sub_diff/gsub.rb |