Class: TicketAntecedent

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
app/models/ticket_antecedent.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ticket_or_commit, kind, id) ⇒ TicketAntecedent

Returns a new instance of TicketAntecedent.



4
5
6
7
8
# File 'app/models/ticket_antecedent.rb', line 4

def initialize(ticket_or_commit, kind, id)
  @ticket_or_commit = ticket_or_commit
  @kind = kind
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'app/models/ticket_antecedent.rb', line 10

def id
  @id
end

#kindObject (readonly)

Returns the value of attribute kind.



10
11
12
# File 'app/models/ticket_antecedent.rb', line 10

def kind
  @kind
end

#ticket_or_commitObject (readonly)

Returns the value of attribute ticket_or_commit.



10
11
12
# File 'app/models/ticket_antecedent.rb', line 10

def ticket_or_commit
  @ticket_or_commit
end

Class Method Details

.from_s(ticket, string) ⇒ Object



13
14
15
# File 'app/models/ticket_antecedent.rb', line 13

def self.from_s(ticket, string)
  new ticket, *string.split(":")
end

Instance Method Details

#<=>(other) ⇒ Object



21
22
23
# File 'app/models/ticket_antecedent.rb', line 21

def <=>(other)
  [kind, id] <=> [other.kind, other.id]
end

#close!Object



35
36
37
# File 'app/models/ticket_antecedent.rb', line 35

def close!
  Houston.observer.fire "antecedent:#{kind.downcase.underscore}:closed", self
end

#released!(release = nil) ⇒ Object



27
28
29
# File 'app/models/ticket_antecedent.rb', line 27

def released!(release=nil)
  Houston.observer.fire "antecedent:#{kind.downcase.underscore}:released", self
end

#resolve!Object



31
32
33
# File 'app/models/ticket_antecedent.rb', line 31

def resolve!
  Houston.observer.fire "antecedent:#{kind.downcase.underscore}:resolved", self
end

#to_sObject



17
18
19
# File 'app/models/ticket_antecedent.rb', line 17

def to_s
  "#{kind}:#{id}"
end