Sha256: 547b88981fa16a14f7459151bf57ab980e1c356a3c8dc2f158be66fcd1bcd40e

Contents?: true

Size: 527 Bytes

Versions: 1

Compression:

Stored size: 527 Bytes

Contents

module Pronto
  module Git
    class Patches
      include Enumerable

      attr_reader :commit, :repo

      def initialize(repo, commit, patches)
        @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

1 entries across 1 versions & 1 rubygems

Version Path
pronto-0.3.0 lib/pronto/git/patches.rb