Sha256: d7091fafe29f92b66b6d757c41f2da79dc392fa10c3dcca6675467763a55f8f8

Contents?: true

Size: 548 Bytes

Versions: 7

Compression:

Stored size: 548 Bytes

Contents

module Pronto
  module Git
    class Patches
      include Enumerable

      attr_reader :commit, :repo

      def initialize(repo, commit, patches)
        @repo = repo
        @commit = commit
        @patches = patches.map { |patch| Git::Patch.new(patch, repo) }
      end

      def each(&block)
        @patches.each(&block)
      end

      def find_line(path, line)
        patch = find { |p| p.new_file_full_path == path }
        lines = patch ? patch.lines : []
        lines.find { |l| l.new_lineno == line }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pronto-0.4.3 lib/pronto/git/patches.rb
pronto-0.4.2 lib/pronto/git/patches.rb
pronto-0.4.1 lib/pronto/git/patches.rb
pronto-0.4.0 lib/pronto/git/patches.rb
pronto-0.3.3 lib/pronto/git/patches.rb
pronto-0.3.2 lib/pronto/git/patches.rb
pronto-0.3.1 lib/pronto/git/patches.rb