Class: LockDiff::Github::PrLockfile

Inherits:
Object
  • Object
show all
Defined in:
lib/lock_diff/github/pr_lockfile.rb

Instance Method Summary collapse

Constructor Details

#initialize(pull_request, lockfile_name) ⇒ PrLockfile

Returns a new instance of PrLockfile.



4
5
6
7
# File 'lib/lock_diff/github/pr_lockfile.rb', line 4

def initialize(pull_request, lockfile_name)
  @pr = pull_request
  @lockfile_name = lockfile_name
end

Instance Method Details

#base_fileObject



17
18
19
# File 'lib/lock_diff/github/pr_lockfile.rb', line 17

def base_file
  @base_file ||= LockDiff.client.file(@pr.repository, path: path, ref: @pr.base_sha)
end

#changed?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/lock_diff/github/pr_lockfile.rb', line 9

def changed?
  !!path
end

#head_fileObject



21
22
23
# File 'lib/lock_diff/github/pr_lockfile.rb', line 21

def head_file
  @head_file ||= LockDiff.client.file(@pr.repository, path: path, ref: @pr.head_sha)
end

#pathObject



13
14
15
# File 'lib/lock_diff/github/pr_lockfile.rb', line 13

def path
  @path ||= @pr.find_content_path(@lockfile_name)
end