Class: Reaper::Issue
- Inherits:
-
Object
- Object
- Reaper::Issue
- Defined in:
- lib/reaper/issue.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#state ⇒ Object
Returns the value of attribute state.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #closed? ⇒ Boolean
-
#initialize(issue) ⇒ Issue
constructor
A new instance of Issue.
- #protect ⇒ Object
-
#reap ⇒ Object
Action methods.
- #warn(warning) ⇒ Object
Constructor Details
#initialize(issue) ⇒ Issue
Returns a new instance of Issue.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/reaper/issue.rb', line 5 def initialize(issue) @issue = issue @title = @issue.title @body = @issue.body @state = @issue.state @labels = issue.labels.map(&:name) @buffered_comments = [] @client = Reaper::Client.instance end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object (private)
56 57 58 |
# File 'lib/reaper/issue.rb', line 56 def method_missing(meth, *args, &block) @issue.send(meth, *args, &block) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/reaper/issue.rb', line 3 def body @body end |
#labels ⇒ Object
Returns the value of attribute labels.
3 4 5 |
# File 'lib/reaper/issue.rb', line 3 def labels @labels end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/reaper/issue.rb', line 3 def state @state end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/reaper/issue.rb', line 3 def title @title end |
Instance Method Details
#closed? ⇒ Boolean
37 38 39 |
# File 'lib/reaper/issue.rb', line 37 def closed? @state == 'closed' end |
#protect ⇒ Object
31 32 33 34 35 |
# File 'lib/reaper/issue.rb', line 31 def protect @labels << 'do-not-reap' @labels -= ['to-reap'] save end |
#reap ⇒ Object
Action methods
19 20 21 22 23 |
# File 'lib/reaper/issue.rb', line 19 def reap @labels << 'reaped' @labels -= ['to-reap'] @client.close_issue(@issue.number, labels: @labels) end |
#warn(warning) ⇒ Object
25 26 27 28 29 |
# File 'lib/reaper/issue.rb', line 25 def warn(warning) @labels << 'to-reap' comment(warning) save end |