Class: PRlist::PullRequest
- Inherits:
-
Object
- Object
- PRlist::PullRequest
show all
- Defined in:
- lib/pr_list/pull_requests.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of PullRequest.
15
16
17
|
# File 'lib/pr_list/pull_requests.rb', line 15
def initialize(issue)
@issue ||= issue
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
7
8
9
|
# File 'lib/pr_list/pull_requests.rb', line 7
def method_missing(method_sym, *arguments, &block)
@issue.respond_to?(method_sym) ? @issue.send(method_sym, *arguments, &block) : super
end
|
Instance Attribute Details
#issue ⇒ Object
Returns the value of attribute issue.
5
6
7
|
# File 'lib/pr_list/pull_requests.rb', line 5
def issue
@issue
end
|
Instance Method Details
#date ⇒ Object
19
20
21
|
# File 'lib/pr_list/pull_requests.rb', line 19
def date
@issue.created_at
end
|
#has_label?(filter_by) ⇒ Boolean
23
24
25
|
# File 'lib/pr_list/pull_requests.rb', line 23
def has_label?(filter_by)
labels.any? { |label| [filter_by].flatten.map { |l| l.downcase.strip }.include?(label.downcase.strip) }
end
|
#labels ⇒ Object
27
28
29
|
# File 'lib/pr_list/pull_requests.rb', line 27
def labels
@issue.labels.map { |l| l.name }
end
|
#repo(opt = {}) ⇒ Object
31
32
33
34
35
|
# File 'lib/pr_list/pull_requests.rb', line 31
def repo(opt = {})
opt[:short] = false unless opt.has_key?(:short)
/repos\/(\w*\/?(.*))$/.match(@issue.repository_url)[opt[:short] ? 2 : 1]
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
11
12
13
|
# File 'lib/pr_list/pull_requests.rb', line 11
def respond_to_missing?(method_name, include_private = false)
@issue.respond_to?(method_name.to_sym) || super
end
|