class Jira::Command::Comment::List
Attributes
comment[RW]
ticket[RW]
Public Class Methods
new(ticket)
click to toggle source
# File lib/jira/commands/comment/list.rb, line 17 def initialize(ticket) self.ticket = ticket end
Public Instance Methods
run()
click to toggle source
# File lib/jira/commands/comment/list.rb, line 21 def run return if comments.nil? if comments.empty? puts "Ticket #{ticket} has no comments." return end render_table(header, rows) end
Private Instance Methods
body()
click to toggle source
# File lib/jira/commands/comment/list.rb, line 60 def body body = comment['body'].gsub("\r\n|\r|\n", ";") truncate(body, 45) end
comments()
click to toggle source
# File lib/jira/commands/comment/list.rb, line 65 def comments @comments ||= api.get("issue/#{ticket}/comment")['comments'] end
header()
click to toggle source
# File lib/jira/commands/comment/list.rb, line 35 def header [ 'Author', 'Updated At', 'Body' ] end
row()
click to toggle source
# File lib/jira/commands/comment/list.rb, line 48 def row [ author, updated_at, body ] end
rows()
click to toggle source
# File lib/jira/commands/comment/list.rb, line 39 def rows rows = [] comments.each do |comment| self.comment = comment rows << row end rows end
updated_at()
click to toggle source
# File lib/jira/commands/comment/list.rb, line 56 def updated_at Jira::Format.time(Time.parse(comment['updated'])) end