Class: OctoMerge::InteractivePullRequests

Inherits:
Object
  • Object
show all
Defined in:
lib/octo_merge/interactive_pull_requests.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo:, query:) ⇒ InteractivePullRequests

Returns a new instance of InteractivePullRequests.



5
6
7
8
# File 'lib/octo_merge/interactive_pull_requests.rb', line 5

def initialize(repo:, query:)
  @repo = repo
  @query = query
end

Class Method Details

.get(options = {}) ⇒ Object



10
11
12
# File 'lib/octo_merge/interactive_pull_requests.rb', line 10

def self.get(options = {})
  new(repo: options[:repo], query: options[:query]).to_s
end

Instance Method Details

#to_sObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/octo_merge/interactive_pull_requests.rb', line 14

def to_s
  system("clear")

  idx = Ask.checkbox(
    "Select the pull requests you want to merge",
    formatted_pull_requests
  )

  idx.zip(pull_requests).select { |e| e[0] }.map { |e| e[1].number }.join(",")
end