Sha256: 7fc45364cf85b2abeb68ab4f4191b53fb0727243d693a9144be863d4cb5740d7
Contents?: true
Size: 459 Bytes
Versions: 1
Compression:
Stored size: 459 Bytes
Contents
module SubDiff class Differ extend Forwardable def_delegators :builder, :diff_method, :string attr_reader :builder def initialize(builder) @builder = builder end def each_diff(search, *args, block) string.send(diff_method, search) do |match| diff = { match: match, prefix: $`, suffix: $' } diff[:replacement] = match.sub(search, *args, &block) yield(builder, diff) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sub_diff-1.1.0 | lib/sub_diff/differ.rb |