Class: Git::Pr::Release::PullRequest

Inherits:
Object
  • Object
show all
Extended by:
Util
Includes:
Util
Defined in:
lib/git/pr/release/pull_request.rb

Constant Summary

Constants included from Util

Util::DEFAULT_PR_TEMPLATE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util

build_pr_title_and_body, dump_result_as_json, git, git_config, git_config_set, host_and_repository_and_scheme, merge_pr_body, obtain_token!, request_authorization, say

Constructor Details

#initialize(pr) ⇒ PullRequest

Returns a new instance of PullRequest.



9
10
11
# File 'lib/git/pr/release/pull_request.rb', line 9

def initialize(pr)
  @pr = pr
end

Instance Attribute Details

#prObject (readonly)

Returns the value of attribute pr.



7
8
9
# File 'lib/git/pr/release/pull_request.rb', line 7

def pr
  @pr
end

Class Method Details

.mention_typeObject



36
37
38
# File 'lib/git/pr/release/pull_request.rb', line 36

def self.mention_type
  @mention_type ||= (git_config('mention') || 'default')
end

Instance Method Details



17
18
19
# File 'lib/git/pr/release/pull_request.rb', line 17

def html_link
  pr.rels[:html].href
end

#mentionObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/git/pr/release/pull_request.rb', line 25

def mention
  mention = case PullRequest.mention_type
            when 'author'
              pr.user ? "@#{pr.user.}" : nil
            else
              pr.assignee ? "@#{pr.assignee.}" : pr.user ? "@#{pr.user.}" : nil
            end

  mention ? " #{mention}" : ""
end

#to_checklist_itemObject



13
14
15
# File 'lib/git/pr/release/pull_request.rb', line 13

def to_checklist_item
  "- [ ] ##{pr.number} #{pr.title}" + mention
end

#to_hashObject



21
22
23
# File 'lib/git/pr/release/pull_request.rb', line 21

def to_hash
  { :data => @pr.to_hash }
end