diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-05-14 23:59:39 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-05-26 22:48:32 +0300 |
commit | b88da58cb6272a86b6df2e4efe392f10e689a6b2 (patch) | |
tree | 1271524cfe6fa5d733cc847c72b96a19810d06aa /app/models/external_issue.rb | |
parent | 94af050117df20a661e03055a5002cae90282d6d (diff) |
Add `reference_pattern` to Referable models
Diffstat (limited to 'app/models/external_issue.rb')
-rw-r--r-- | app/models/external_issue.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/models/external_issue.rb b/app/models/external_issue.rb index 6fda4a2ab77..49f6c95e045 100644 --- a/app/models/external_issue.rb +++ b/app/models/external_issue.rb @@ -9,10 +9,6 @@ class ExternalIssue @issue_identifier.to_s end - def to_reference(_from_project = nil) - id - end - def id @issue_identifier.to_s end @@ -32,4 +28,13 @@ class ExternalIssue def project @project end + + # Pattern used to extract `JIRA-123` issue references from text + def self.reference_pattern + %r{(?<issue>([A-Z\-]+-)\d+)} + end + + def to_reference(_from_project = nil) + id + end end |