Class: Gitlab::Git::Changes

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/gitlab/git/changes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeChanges

Returns a new instance of Changes.


10
11
12
13
14
15
16
# File 'lib/gitlab/git/changes.rb', line 10

def initialize
  @refs = Set.new
  @items = []
  @branches_index = []
  @tags_index = []
  @repository_data = []
end

Instance Attribute Details

#repository_dataObject (readonly)

Returns the value of attribute repository_data


8
9
10
# File 'lib/gitlab/git/changes.rb', line 8

def repository_data
  @repository_data
end

Instance Method Details

#add_branch_change(change) ⇒ Object


26
27
28
29
# File 'lib/gitlab/git/changes.rb', line 26

def add_branch_change(change)
  @branches_index << add_change(change)
  self
end

#add_tag_change(change) ⇒ Object


31
32
33
34
# File 'lib/gitlab/git/changes.rb', line 31

def add_tag_change(change)
  @tags_index << add_change(change)
  self
end

#branch_changesObject


46
47
48
# File 'lib/gitlab/git/changes.rb', line 46

def branch_changes
  items.values_at(*branches_index)
end

#eachObject


36
37
38
39
40
# File 'lib/gitlab/git/changes.rb', line 36

def each
  items.each do |item|
    yield item
  end
end

#includes_branches?Boolean

Returns:

  • (Boolean)

18
19
20
# File 'lib/gitlab/git/changes.rb', line 18

def includes_branches?
  branches_index.any?
end

#includes_tags?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/gitlab/git/changes.rb', line 22

def includes_tags?
  tags_index.any?
end

#refsObject


42
43
44
# File 'lib/gitlab/git/changes.rb', line 42

def refs
  @refs.to_a
end

#tag_changesObject


50
51
52
# File 'lib/gitlab/git/changes.rb', line 50

def tag_changes
  items.values_at(*tags_index)
end