Class: Tracker::XForge::Base

Inherits:
Base
  • Object
show all
Includes:
DigitIssues
Defined in:
lib/tracker/xforge/base.rb

Overview

TODO: rename to Project

Direct Known Subclasses

RubyForge

Defined Under Namespace

Classes: SubTracker

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DigitIssues

#identifier_examples, #identifier_regexp

Methods inherited from Base

classes

Constructor Details

#initialize(uri = nil, project = nil) ⇒ Base

Returns a new instance of Base.



9
10
11
# File 'lib/tracker/xforge/base.rb', line 9

def initialize(uri=nil, project=nil)
  @uri, @project = uri, project
end

Instance Attribute Details

#projectObject

Returns the value of attribute project.



7
8
9
# File 'lib/tracker/xforge/base.rb', line 7

def project
  @project
end

#uriObject

Returns the value of attribute uri.



7
8
9
# File 'lib/tracker/xforge/base.rb', line 7

def uri
  @uri
end

Instance Method Details

#issue(identifier) ⇒ Object

Finds an Issue by identifier



14
15
16
17
18
19
20
21
# File 'lib/tracker/xforge/base.rb', line 14

def issue(identifier)
  sub_trackers = atids.collect {|atid| SubTracker.new(self, atid)}
  sub_trackers.each do |sub_tracker|
    issue = sub_tracker.issue(identifier)
    return issue unless issue.nil?
  end
  nil
end

#markup(text) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/tracker/xforge/base.rb', line 23

def markup(text)
  text.gsub(identifier_regexp) do |match|
    issue_identifier = $1
    issue = issue(issue_identifier)
    issue ? "<a href=\"#{issue.uri}\">#{issue.summary}</a>" : "\##{issue_identifier}"
  end
end