Sha256: 0cc10de1fcd05b3624c3b5b2d90a7167e39fbf2caeba3656e5343ddf1981ff0f
Contents?: true
Size: 693 Bytes
Versions: 1
Compression:
Stored size: 693 Bytes
Contents
require 'delegate' require 'forwardable' require 'sub_diff/diff' module SubDiff class DiffCollection < SimpleDelegator extend Forwardable include Enumerable attr_reader :string, :diffs def_delegators :diffs, :each, :size def initialize(string) @string = string @diffs = [] super(string) end def changed? diffs.any?(&:changed?) end def push(*args) if args.compact.any? diff = Diff.new(*args) append(diff) end self end alias_method :<<, :push private def append(diff) unless diff.empty? diffs << diff __setobj__(diffs.join) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sub_diff-1.0.0 | lib/sub_diff/diff_collection.rb |