2015-02-02 18:11:19 -05:00
|
|
|
class ExternalIssue
|
2015-05-02 23:11:21 -04:00
|
|
|
include Referable
|
|
|
|
|
2015-02-02 18:11:19 -05:00
|
|
|
def initialize(issue_identifier, project)
|
|
|
|
@issue_identifier, @project = issue_identifier, project
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_s
|
|
|
|
@issue_identifier.to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
def id
|
|
|
|
@issue_identifier.to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
def iid
|
|
|
|
@issue_identifier.to_s
|
|
|
|
end
|
|
|
|
|
2015-04-30 17:27:33 -04:00
|
|
|
def title
|
|
|
|
"External Issue #{self}"
|
|
|
|
end
|
|
|
|
|
2015-02-02 18:11:19 -05:00
|
|
|
def ==(other)
|
|
|
|
other.is_a?(self.class) && (to_s == other.to_s)
|
|
|
|
end
|
|
|
|
|
|
|
|
def project
|
|
|
|
@project
|
|
|
|
end
|
2015-05-14 16:59:39 -04:00
|
|
|
|
|
|
|
# Pattern used to extract `JIRA-123` issue references from text
|
|
|
|
def self.reference_pattern
|
2016-01-25 11:27:03 -05:00
|
|
|
%r{(?<issue>\b([A-Z][A-Z0-9_]+-)\d+)}
|
2015-05-14 16:59:39 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_reference(_from_project = nil)
|
|
|
|
id
|
|
|
|
end
|
2015-02-02 18:11:19 -05:00
|
|
|
end
|