Class: Zend::Command::Ticket::Show

Inherits:
Base
  • Object
show all
Defined in:
lib/zend/command/ticket/show.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#api, #is_num?, #terminal_width, #truncate

Constructor Details

#initialize(id) ⇒ Show

Returns a new instance of Show.



6
7
8
9
10
# File 'lib/zend/command/ticket/show.rb', line 6

def initialize(id)
  @ticket = remote_ticket(id)

  puts(output)
end

Instance Attribute Details

#ticketObject (readonly)

Returns the value of attribute ticket.



4
5
6
# File 'lib/zend/command/ticket/show.rb', line 4

def ticket
  @ticket
end

Instance Method Details

#outputObject



12
13
14
# File 'lib/zend/command/ticket/show.rb', line 12

def output
  table.to_s + ticket.description
end

#tableObject



16
17
18
19
20
21
22
23
24
# File 'lib/zend/command/ticket/show.rb', line 16

def table
  Terminal::Table.new(
    style: {
      width: terminal_width,
      padding_left: 3
    },
    rows: tabular_data
  )
end

#tabular_dataObject



26
27
28
29
30
31
# File 'lib/zend/command/ticket/show.rb', line 26

def tabular_data
  rows = Array.new
  rows << [value: col_subject, colspan: 3]
  rows << :separator
  rows << [col_requester, col_created, col_updated]
end