mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-07-25 16:03:48 +00:00
27 lines
519 B
Ruby
27 lines
519 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
class ChangesList
|
|
include Enumerable
|
|
|
|
attr_reader :raw_changes
|
|
|
|
def initialize(changes)
|
|
@raw_changes = changes.is_a?(String) ? changes.lines : changes
|
|
end
|
|
|
|
def each(&block)
|
|
changes.each(&block)
|
|
end
|
|
|
|
def changes
|
|
@changes ||= @raw_changes.filter_map do |change|
|
|
next if change.blank?
|
|
|
|
oldrev, newrev, ref = change.strip.split(' ')
|
|
{ oldrev: oldrev, newrev: newrev, ref: ref }
|
|
end
|
|
end
|
|
end
|
|
end
|