| Class | Sipttra::Ticket |
| In: |
lib/webgen/sipttra_format.rb
|
| Parent: | Node |
Represents a ticket line.
| belongs_to | [RW] | |
| due_date | [RW] | |
| name | [RW] | |
| summary | [RW] |
# File lib/webgen/sipttra_format.rb, line 111
111: def initialize( name, due_date, belongs_to, text = '' )
112: @name = name
113: @due_date = due_date
114: @belongs_to = belongs_to
115: @summary = text.strip
116: end
Returns the whole text for the ticket, ie. the summary and ticket joined by a line separator.
# File lib/webgen/sipttra_format.rb, line 159
159: def all_text
160: [@summary, description].join( "\n" )
161: end
Returns the tickets assigned to this ticket, ie. all sub-tickets. The type parameter can be one of:
| :open : | all tickets with a type different from closed |
| :closed : | all tickets with type closed |
| :all : | all tickets independent from type |
# File lib/webgen/sipttra_format.rb, line 135
135: def assigned_tickets( type = :all )
136: if @name.nil?
137: []
138: else
139: @tracker.tickets.select do |t|
140: t.belongs_to == @name &&
141: (type == :all || (type == :closed ? t.category.type == 'closed' : t.category.type != 'closed' ))
142: end
143: end
144: end
Returns the detailed description for this ticket.
# File lib/webgen/sipttra_format.rb, line 147
147: def description
148: text = []
149: line = nil
150: i = @tracker.nodes.index( self ) + 1
151: while i < @tracker.nodes.length && (line = @tracker.nodes[i]).kind_of?( AdditionalText )
152: text << line
153: i += 1
154: end
155: text.join( "\n" ).strip
156: end
# File lib/webgen/sipttra_format.rb, line 164
164: def to_line
165: s = '*'
166: s << ' ' + name unless name.nil?
167: s << ' (' + due_date + ')' unless due_date.nil?
168: s << ' [' + belongs_to + ']' unless belongs_to.nil?
169: s << (!name.nil? && due_date.nil? && belongs_to.nil? ? ':' : '' ) + (summary.empty? ? '' : ' ' + summary.to_s)
170: s
171: end