debian-mirror-gitlab/lib/gitlab/changes_list.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
519 B
Ruby
Raw Permalink Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2016-09-13 17:45:13 +05:30
module Gitlab
class ChangesList
include Enumerable
attr_reader :raw_changes
def initialize(changes)
2017-08-17 22:00:37 +05:30
@raw_changes = changes.is_a?(String) ? changes.lines : changes
2016-09-13 17:45:13 +05:30
end
def each(&block)
changes.each(&block)
end
def changes
2023-05-27 22:25:52 +05:30
@changes ||= @raw_changes.filter_map do |change|
2023-03-04 22:38:38 +05:30
next if change.blank?
2018-03-17 18:26:18 +05:30
2023-03-04 22:38:38 +05:30
oldrev, newrev, ref = change.strip.split(' ')
{ oldrev: oldrev, newrev: newrev, ref: ref }
2023-05-27 22:25:52 +05:30
end
2016-09-13 17:45:13 +05:30
end
end
end