Class: Reaper::Issue

Inherits:
Object
  • Object
show all
Defined in:
lib/reaper/issue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/reaper/issue.rb', line 3

def body
  @body
end

#labelsObject

Returns the value of attribute labels.



3
4
5
# File 'lib/reaper/issue.rb', line 3

def labels
  @labels
end

#stateObject

Returns the value of attribute state.



3
4
5
# File 'lib/reaper/issue.rb', line 3

def state
  @state
end

#titleObject

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

Returns:

  • (Boolean)


37
38
39
# File 'lib/reaper/issue.rb', line 37

def closed?
  @state == 'closed'
end

#protectObject



31
32
33
34
35
# File 'lib/reaper/issue.rb', line 31

def protect
  @labels << 'do-not-reap'
  @labels -= ['to-reap']
  save
end

#reapObject

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