class Diffy::Diff
def each
def each lines = case @options[:include_diff_info] when false # this "primes" the diff and sets up the paths we'll reference below. diff # caching this regexp improves the performance of the loop by a # considerable amount. regexp = /^(--- "?#{@paths[0]}"?|\+\+\+ "?#{@paths[1]}"?|@@|\\\\)/ diff.split("\n").reject{|x| x =~ regexp }.map {|line| line + "\n" } when true diff.split("\n").map {|line| line + "\n" } end if block_given? lines.each{|line| yield line} else lines.to_enum end end