Class: Git::GitBranch

Inherits:
Object
  • Object
show all
Defined in:
lib/git/git_branch.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository_name, name, last_modified_date, author_name, author_email) ⇒ GitBranch

Returns a new instance of GitBranch.



7
8
9
10
11
12
13
# File 'lib/git/git_branch.rb', line 7

def initialize(repository_name, name, last_modified_date, author_name, author_email)
  @repository_name = repository_name
  @name = name
  @last_modified_date = last_modified_date
  @author_email = author_email
  @author_name = author_name
end

Instance Attribute Details

#author_emailObject (readonly)

Returns the value of attribute author_email.



5
6
7
# File 'lib/git/git_branch.rb', line 5

def author_email
  @author_email
end

#author_nameObject (readonly)

Returns the value of attribute author_name.



5
6
7
# File 'lib/git/git_branch.rb', line 5

def author_name
  @author_name
end

#last_modified_dateObject (readonly)

Returns the value of attribute last_modified_date.



5
6
7
# File 'lib/git/git_branch.rb', line 5

def last_modified_date
  @last_modified_date
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/git/git_branch.rb', line 5

def name
  @name
end

#repository_nameObject (readonly)

Returns the value of attribute repository_name.



5
6
7
# File 'lib/git/git_branch.rb', line 5

def repository_name
  @repository_name
end

Class Method Details

.name_from_ref(ref) ⇒ Object



31
32
33
# File 'lib/git/git_branch.rb', line 31

def self.name_from_ref(ref)
  ref.gsub(/^refs\/heads\//, '')
end

Instance Method Details

#==(other) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/git/git_branch.rb', line 23

def ==(other)
  repository_name == other.repository_name \
    && name == other.name && \
    last_modified_date == other.last_modified_date \
    && author_email == other.author_email \
    && author_name == other.author_name
end

#=~(other) ⇒ Object



19
20
21
# File 'lib/git/git_branch.rb', line 19

def =~(other)
  name =~ other
end

#to_sObject



15
16
17
# File 'lib/git/git_branch.rb', line 15

def to_s
  name
end