Class Sipttra::Ticket
In: lib/webgen/sipttra_format.rb
Parent: Node
TextNode AdditionalText Comment Node Ticket Category Milestone Tracker lib/webgen/sipttra_format.rb Sipttra dot/m_7_0.png

Represents a ticket line.

Methods

Attributes

belongs_to  [RW] 
due_date  [RW] 
name  [RW] 
summary  [RW] 

Public Class methods

[Source]

     # 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

Public Instance methods

Returns the whole text for the ticket, ie. the summary and ticket joined by a line separator.

[Source]

     # 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

[Source]

     # 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 category to which this ticket belongs.

[Source]

     # File lib/webgen/sipttra_format.rb, line 119
119:     def category
120:       i = @tracker.nodes.index( self ) - 1
121:       i -= 1 while i >= 0 && !@tracker.nodes[i].kind_of?( Category )
122:       (i < 0 ? nil : @tracker.nodes[i])
123:     end

Returns true if this ticket is closed, ie. if it belongs to a category with type closed.

[Source]

     # File lib/webgen/sipttra_format.rb, line 126
126:     def closed?
127:       category.type == 'closed'
128:     end

Returns the detailed description for this ticket.

[Source]

     # 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

[Source]

     # 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
to_s()

Alias for all_text

[Validate]