Class: GitHooks::GitAdapter::Commits

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/git_hooks/git_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commits, ref_name, repo) ⇒ Commits

Returns a new instance of Commits.



12
13
14
15
16
# File 'lib/git_hooks/git_adapter.rb', line 12

def initialize(commits, ref_name, repo)
  @commits       = commits
  self.ref_name  = ref_name
  self.repo_name = repo
end

Instance Attribute Details

#ref_nameObject

Returns the value of attribute ref_name.



10
11
12
# File 'lib/git_hooks/git_adapter.rb', line 10

def ref_name
  @ref_name
end

#repo_nameObject

Returns the value of attribute repo_name.



10
11
12
# File 'lib/git_hooks/git_adapter.rb', line 10

def repo_name
  @repo_name
end

Instance Method Details

#eachObject



18
19
20
# File 'lib/git_hooks/git_adapter.rb', line 18

def each
  @commits.each { |commit| yield commit }
end

#sizeObject



22
23
24
# File 'lib/git_hooks/git_adapter.rb', line 22

def size
  @commits.size
end