Sha256: 4ed0377582ad55f238130a8b3ddf0aa8554f78623f7458c7ada0b0634662b71d

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

class TicketAntecedent
  include Comparable
  
  def initialize(ticket_or_commit, kind, id)
    @ticket_or_commit = ticket_or_commit
    @kind = kind
    @id = id
  end
  
  attr_reader :ticket_or_commit, :kind, :id
  delegate :project, to: :ticket_or_commit
  
  def self.from_s(ticket, string)
    new ticket, *string.split(":")
  end
  
  def to_s
    "#{kind}:#{id}"
  end
  
  def <=>(other)
    [kind, id] <=> [other.kind, other.id]
  end
  
  
  
  def released!(release=nil)
    Houston.observer.fire "antecedent:#{kind.downcase.underscore}:released", self
  end
  
  def resolve!
    Houston.observer.fire "antecedent:#{kind.downcase.underscore}:resolved", self
  end
  
  def close!
    Houston.observer.fire "antecedent:#{kind.downcase.underscore}:closed", self
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
houston-core-0.5.0.beta1 app/models/ticket_antecedent.rb