Class: Leandocument::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/leandocument/repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Repository

Returns a new instance of Repository.



5
6
7
8
# File 'lib/leandocument/repository.rb', line 5

def initialize(options = {})
  self.base_path = options[:base_path] || Dir.pwd
  self.repo      = Grit::Repo.new(self.base_path)
end

Instance Attribute Details

#base_pathObject

Returns the value of attribute base_path.



3
4
5
# File 'lib/leandocument/repository.rb', line 3

def base_path
  @base_path
end

#repoObject

Returns the value of attribute repo.



3
4
5
# File 'lib/leandocument/repository.rb', line 3

def repo
  @repo
end

Instance Method Details

#branches(id = nil) ⇒ Object



14
15
16
# File 'lib/leandocument/repository.rb', line 14

def branches(id = nil)
  id.nil?? self.repo.branches : self.repo.branches(id).first
end

#commits(id = nil) ⇒ Object



10
11
12
# File 'lib/leandocument/repository.rb', line 10

def commits(id = nil)
  id.nil?? self.repo.commits : self.repo.commits(id)
end