Class: Danger::LocalPullRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/danger/ci_source/support/local_pull_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(log_line) ⇒ LocalPullRequest

Returns a new instance of LocalPullRequest.



5
6
7
8
# File 'lib/danger/ci_source/support/local_pull_request.rb', line 5

def initialize(log_line)
  @pull_request_id = log_line.match(/#(?<id>[0-9]+)/)[:id]
  @sha = log_line.split(" ".freeze).first
end

Instance Attribute Details

#pull_request_idObject (readonly)

Returns the value of attribute pull_request_id.



3
4
5
# File 'lib/danger/ci_source/support/local_pull_request.rb', line 3

def pull_request_id
  @pull_request_id
end

#shaObject (readonly)

Returns the value of attribute sha.



3
4
5
# File 'lib/danger/ci_source/support/local_pull_request.rb', line 3

def sha
  @sha
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/danger/ci_source/support/local_pull_request.rb', line 10

def valid?
  pull_request_id && sha
end