Sha256: 4e620dfd52c1d101c907b9007bbdd3401fe872e01ef9275615d581955ef77317
Contents?: true
Size: 777 Bytes
Versions: 1
Compression:
Stored size: 777 Bytes
Contents
module Stash class PullRequest class Diff def initialize(diff) @diff = diff end def added_line?(file, line) added_lines(file).include?(line) end private def added_lines(file) @added_lines ||= {} @added_lines[file] ||= begin file_diff(file)['hunks'].map do |hunk| hunk['segments'].select{|segment| segment['type'] == 'ADDED' }.map do |segment| segment['lines'].map do |line| line['destination'] end end end.flatten end end def file_diff(file) @diff['diffs'].detect{|diff| diff['destination'] && diff['destination']['toString'] == file } || {'hunks' => []} end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
face_control-0.6.0 | lib/stash/pull_request/diff.rb |