class OpenPull::PullRequestDecorator
Public Instance Methods
as_row(username)
click to toggle source
# File lib/openpull/pull_request_decorator.rb, line 5 def as_row(username) [title, user(username), labels, status, commits, comments, mergeable, html_url.underline, updated_at] end
comments()
click to toggle source
# File lib/openpull/pull_request_decorator.rb, line 47 def comments num = rels[:comments].get.data.size num += rels[:review_comments].get.data.size num.zero? ? '' : num end
commits()
click to toggle source
# File lib/openpull/pull_request_decorator.rb, line 42 def commits num = rels[:commits].get.data.size num.zero? ? '' : num end
labels()
click to toggle source
# File lib/openpull/pull_request_decorator.rb, line 22 def labels issue = rels[:issue].get.data labels = issue.rels[:labels].get.data labels.map { |l| l.name.yellow }.join(', ') end
mergeable()
click to toggle source
Calls superclass method
# File lib/openpull/pull_request_decorator.rb, line 53 def mergeable super ? 'Yes'.green : 'No'.red end
status()
click to toggle source
# File lib/openpull/pull_request_decorator.rb, line 29 def status state = rels[:statuses].get.data.map(&:state).first case state when 'success' state.green when 'pending' state.yellow else (state || '--').red end end
title()
click to toggle source
Calls superclass method
# File lib/openpull/pull_request_decorator.rb, line 10 def title title = super return title if title.size <= 80 title[0, 80] + '...' end
user(other)
click to toggle source
Calls superclass method
# File lib/openpull/pull_request_decorator.rb, line 17 def user(other) user = super().login user == other ? user.blue : user end
Private Instance Methods
rels()
click to toggle source
# File lib/openpull/pull_request_decorator.rb, line 59 def rels __getobj__.rels end