Class: Wassup::Panes::GitHub::PullRequests

Inherits:
Object
  • Object
show all
Defined in:
lib/wassup/panes/github.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(org:, repo:, show_username: false, show_interactions: false) ⇒ PullRequests

Returns a new instance of PullRequests.



10
11
12
13
14
15
# File 'lib/wassup/panes/github.rb', line 10

def initialize(org:, repo:, show_username: false, show_interactions: false)
  @org = org
  @repo = repo
  @show_username = show_username
  @show_interactions = show_interactions
end

Instance Attribute Details

#orgObject

Returns the value of attribute org.



5
6
7
# File 'lib/wassup/panes/github.rb', line 5

def org
  @org
end

#repoObject

Returns the value of attribute repo.



6
7
8
# File 'lib/wassup/panes/github.rb', line 6

def repo
  @repo
end

#show_interactionsObject

Returns the value of attribute show_interactions.



8
9
10
# File 'lib/wassup/panes/github.rb', line 8

def show_interactions
  @show_interactions
end

#show_usernameObject

Returns the value of attribute show_username.



7
8
9
# File 'lib/wassup/panes/github.rb', line 7

def show_username
  @show_username
end

Instance Method Details

#configure(pane) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/wassup/panes/github.rb', line 17

def configure(pane)
  pane.content do |content|
    prs = Helpers::GitHub.pull_requests(org: org, repo: repo)
    prs.each do |pr|
      display = Helpers::GitHub::Formatter.pr(pr, show_username: show_username, show_interactions: show_interactions)
      content.add_row(display, pr)
    end
  end
  pane.selection('enter', 'Open PR in browser') do |pr|
    `open #{pr['html_url']}`
  end
end