class Jira::Command::Base
Public Instance Methods
run()
click to toggle source
# File lib/jira/command.rb, line 14 def run raise NotImplementedError end
Protected Instance Methods
api()
click to toggle source
# File lib/jira/command.rb, line 20 def api @api ||= Jira::API.new end
auth_api()
click to toggle source
# File lib/jira/command.rb, line 24 def auth_api @auth_api ||= Jira::AuthAPI.new end
body(text=nil)
click to toggle source
TODO: Move this to relevant subcommand Base
# File lib/jira/command.rb, line 29 def body(text=nil) @body ||= ( comment = text || io.ask("Leave a comment for ticket #{ticket}:", default: 'Empty comment').strip comment = comment.gsub(/\@[a-zA-Z]+/, '[~\0]') || comment comment.gsub('[~@', '[~') || comment ) end
io()
click to toggle source
# File lib/jira/command.rb, line 41 def io @io ||= TTY::Prompt.new end
render_table(header, rows)
click to toggle source
# File lib/jira/command.rb, line 45 def render_table(header, rows) puts TTY::Table.new(header, rows).render(:unicode, padding: [0, 1], multiline: true) end
sprint_api()
click to toggle source
# File lib/jira/command.rb, line 37 def sprint_api @sprint_api ||= Jira::SprintAPI.new end
truncate(string, limit=80)
click to toggle source
# File lib/jira/command.rb, line 49 def truncate(string, limit=80) return string if string.length < limit string[0..limit-3] + '...' end