Class: Gitra::Tracker
- Inherits:
-
Object
show all
- Defined in:
- lib/gitra/tracker.rb
Instance Method Summary
collapse
Constructor Details
#initialize(repository) ⇒ Tracker
Returns a new instance of Tracker.
6
7
8
|
# File 'lib/gitra/tracker.rb', line 6
def initialize(repository)
@git = Git.open(repository)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
26
27
28
29
|
# File 'lib/gitra/tracker.rb', line 26
def method_missing(name, *args, &block)
raise NoMethodError, "method `#{name}' should be used as `<tracker>.branch(reference).#{name}(<args>)'" if TrackedBranch.method_defined? name
super
end
|
Instance Method Details
#branch(branch) ⇒ Object
22
23
24
|
# File 'lib/gitra/tracker.rb', line 22
def branch(branch)
TrackedBranch.new(@git, branch)
end
|
#branches ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/gitra/tracker.rb', line 14
def branches
@git.branches.select do |branch|
name = branch.full.gsub(%r{^remotes/}, '')
next if name =~ / -> /
block_given? ? yield(name) : true
end.map { |branch| branch.full.gsub(%r{^remotes/}, '') }
end
|
#current_branch ⇒ Object
10
11
12
|
# File 'lib/gitra/tracker.rb', line 10
def current_branch
@git.current_branch
end
|