| Class | DiffTools::Diff |
| In: |
lib/diff_tools.rb
|
| Parent: | Object |
# File lib/diff_tools.rb, line 10 def initialize ( anObject=nil ) @chunks = {} @path_list = PathList.new case anObject when String anObject.split(/^Index: /m).each do |chunk| self << 'Index: ' + chunk unless chunk.empty? end when Diff merge! anObject when Array anObject.flatten.each { |chunk| self << chunk } when NilClass else raise TypeError, "Unexpected type #{anObject.class}" end end
# File lib/diff_tools.rb, line 28 def << ( chunk ) chunk = Chunk.new(chunk) unless chunk.is_a? Chunk if @path_list.include? chunk.path raise ArgumentError, "Already have the path `#{chunk.path}'" end @chunks[chunk.path] = chunk @path_list << chunk.path end
# File lib/diff_tools.rb, line 58 def exclude ( *args ) create @path_list.exclude_with_regex_list(RegexList.new(args)) end
# File lib/diff_tools.rb, line 50 def grep ( *args ) create @path_list.grep_with_regex_list(RegexList.new(args)) end
# File lib/diff_tools.rb, line 54 def negative ( *args ) create @path_list.grep_with_negative_regex_list(RegexList.new(args)) end