class Kachikachi::PullRequest
Attributes
client[RW]
content[RW]
diff[RW]
number[RW]
Public Class Methods
new(number, options)
click to toggle source
# File lib/kachikachi/pull_request.rb, line 8 def initialize(number, options) @number = number @options = options end
Public Instance Methods
base()
click to toggle source
# File lib/kachikachi/pull_request.rb, line 50 def base content.base end
patch_list()
click to toggle source
# File lib/kachikachi/pull_request.rb, line 19 def patch_list patch_body = '' patch_list = [] patch_file_name = '' body = false lines = diff.lines lines.each_with_index do |line, index| case line when /^diff\s--git\sa\/(?<file_name>.*)\sb\// unless patch_body.empty? patch_list << Patch.new(patch_file_name, patch_body, @options) patch_body = '' end patch_file_name = Regexp.last_match[:file_name] body = false when /^@@\s-\d+,\d+\s\+\d+,\d+\s@@/ body = true else next unless body patch_body << line last_line = lines.count == index + 1 patch_list << Patch.new(patch_file_name, patch_body, @options) if last_line && !patch_body.empty? end end patch_list end
target_patch_list()
click to toggle source
# File lib/kachikachi/pull_request.rb, line 13 def target_patch_list patch_list.select do |patch| !@options['file-regexp'] || patch.file_name =~ Regexp.new(@options['file-regexp']) end end