Class: Gitlab::Dangerfiles::Changes
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Gitlab::Dangerfiles::Changes
- Defined in:
- lib/gitlab/dangerfiles/changes.rb
Instance Method Summary collapse
-
#added ⇒ Gitlab::Dangerfiles::Changes
Return an
Gitlab::Dangerfiles::Changes
object with only the changes for the added files. -
#by_category(category) ⇒ Gitlab::Dangerfiles::Changes
Changes for the given
category
. -
#categories ⇒ Array<Symbol>
An array of the unique categories of changes.
-
#deleted ⇒ Gitlab::Dangerfiles::Changes
The changes for the deleted files.
-
#files ⇒ Array<String>
An array of the changed files.
-
#has_category?(category) ⇒ Boolean
Whether there are any change for the given
category
. -
#modified ⇒ Gitlab::Dangerfiles::Changes
The changes for the modified files.
-
#renamed_after ⇒ Gitlab::Dangerfiles::Changes
The changes for the renamed files (after the rename).
-
#renamed_before ⇒ Gitlab::Dangerfiles::Changes
The changes for the renamed files (before the rename).
Instance Method Details
#added ⇒ Gitlab::Dangerfiles::Changes
Return an Gitlab::Dangerfiles::Changes
object with only the changes for the added files.
20 21 22 |
# File 'lib/gitlab/dangerfiles/changes.rb', line 20 def added select_by_change_type(:added) end |
#by_category(category) ⇒ Gitlab::Dangerfiles::Changes
Returns changes for the given category
.
54 55 56 |
# File 'lib/gitlab/dangerfiles/changes.rb', line 54 def by_category(category) Changes.new(select { |change| change.category == category }) end |
#categories ⇒ Array<Symbol>
Returns an array of the unique categories of changes.
59 60 61 |
# File 'lib/gitlab/dangerfiles/changes.rb', line 59 def categories map(&:category).uniq end |
#deleted ⇒ Gitlab::Dangerfiles::Changes
Returns the changes for the deleted files.
30 31 32 |
# File 'lib/gitlab/dangerfiles/changes.rb', line 30 def deleted select_by_change_type(:deleted) end |
#files ⇒ Array<String>
Returns an array of the changed files.
64 65 66 |
# File 'lib/gitlab/dangerfiles/changes.rb', line 64 def files map(&:file).uniq end |
#has_category?(category) ⇒ Boolean
Returns whether there are any change for the given category
.
47 48 49 |
# File 'lib/gitlab/dangerfiles/changes.rb', line 47 def has_category?(category) any? { |change| change.category == category } end |
#modified ⇒ Gitlab::Dangerfiles::Changes
Returns the changes for the modified files.
25 26 27 |
# File 'lib/gitlab/dangerfiles/changes.rb', line 25 def modified select_by_change_type(:modified) end |
#renamed_after ⇒ Gitlab::Dangerfiles::Changes
Returns the changes for the renamed files (after the rename).
40 41 42 |
# File 'lib/gitlab/dangerfiles/changes.rb', line 40 def renamed_after select_by_change_type(:renamed_after) end |
#renamed_before ⇒ Gitlab::Dangerfiles::Changes
Returns the changes for the renamed files (before the rename).
35 36 37 |
# File 'lib/gitlab/dangerfiles/changes.rb', line 35 def renamed_before select_by_change_type(:renamed_before) end |