module Pghub::IssueTitle
Constants
- VERSION
Public Class Methods
post(issue_path, input)
click to toggle source
# File lib/pghub/issue_title.rb, line 9 def post(issue_path, input) issue_client = GithubAPI.new(issue_path_from(input, issue_path)) content = issue_client.get_title comment_client = GithubAPI.new(issue_path) comment_client.post(content) end
Private Class Methods
issue_path_from(input, issue_path)
click to toggle source
# File lib/pghub/issue_title.rb, line 19 def issue_path_from(input, issue_path) reg_organization = %r{#{Pghub.config.github_organization}\/} ref_issue_url = %r{ref https:\/\/github.com\/#{Pghub.config.github_organization}\/.+\/\d+} ref_completion_issue_url = %r{ref #(\d+)} if input.match(ref_issue_url).present? matched_word = input.match(ref_issue_url)[0] issue_url = matched_word.match(reg_organization).post_match elsif input.match(ref_completion_issue_url).present? issue_num = input.match(ref_completion_issue_url)[1] data = issue_path.split('/') data[data.length - 1] = issue_num issue_url = data.join('/') else raise IssueUrlNotFound, 'issue_url is not found.' end issue_url.gsub(/pull/, 'issues') end