class Policial::PullRequest

Public: A GitHub Pull Request.

Attributes

github_client[RW]
number[R]
repo[R]
user[R]

Public Class Methods

new(repo:, number:, head_sha:, github_client:, user: nil) click to toggle source
# File lib/policial/pull_request.rb, line 9
def initialize(repo:, number:, head_sha:, github_client:, user: nil)
  @repo = repo
  @number = number
  @head_sha = head_sha
  @user = user
  @github_client = github_client
end

Public Instance Methods

files() click to toggle source
# File lib/policial/pull_request.rb, line 17
def files
  @files ||= @github_client.pull_request_files(
    @repo, @number
  ).map do |file|
    build_commit_file(file)
  end
end
head_commit() click to toggle source
# File lib/policial/pull_request.rb, line 25
def head_commit
  @head_commit ||= Commit.new(@repo, @head_sha, @github_client)
end

Private Instance Methods

build_commit_file(file) click to toggle source
# File lib/policial/pull_request.rb, line 31
def build_commit_file(file)
  CommitFile.new(file, head_commit)
end