Sha256: 769c44b2ea7f5572f013b9af968bb11d795f3581dd335b8aaa3ba4a38301408d
Contents?: true
Size: 642 Bytes
Versions: 4
Compression:
Stored size: 642 Bytes
Contents
module SubDiff class Sub def initialize(differ) @differ = differ end def diff(*args, &block) # Ruby 1.8.7 does not support additional args after * (splat) args.push(block) differ.each_diff(*args) do |builder, diff| process(builder, diff, args.first) end end private attr_reader :differ def process(builder, diff, search) builder << prefix(diff) builder.push(diff[:replacement], diff[:match]) builder << suffix(diff, search) end def prefix(diff) diff[:prefix] end def suffix(diff, _search) diff[:suffix] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sub_diff-1.0.6 | lib/sub_diff/sub.rb |
sub_diff-1.0.5 | lib/sub_diff/sub.rb |
sub_diff-1.0.4 | lib/sub_diff/sub.rb |
sub_diff-1.0.3 | lib/sub_diff/sub.rb |