class Chid::Commands::Pr
Public Instance Methods
run()
click to toggle source
# File lib/chid/commands/pr.rb, line 26 def run json_prs = GitHubApi.prs(by: user) msg = build_msg(json_prs) send_msg(msg) msg end
Private Instance Methods
build_msg(json_prs)
click to toggle source
# File lib/chid/commands/pr.rb, line 41 def build_msg(json_prs) json_prs .filter { |pr| pr['user']['login'] == user } .each_with_object([]) do |pr, memo| pr.transform_keys!(&:to_sym) pr[:user].transform_keys!(&:to_sym) memo << <<~STR ##{pr[:number]} - #{pr[:title]} By #{pr[:user][:login]} Status: #{pr[:state]} Labels: #{pr[:labels].map { |label| label['name'] }.join(', ') } STR end.join("\n---\n\n") end
send_msg(msg)
click to toggle source
# File lib/chid/commands/pr.rb, line 58 def send_msg(msg) puts msg end
user()
click to toggle source
# File lib/chid/commands/pr.rb, line 37 def user options['-user']&.first end