debian-mirror-gitlab/app/finders/union_finder.rb

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

16 lines
305 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2016-06-02 11:05:42 +05:30
class UnionFinder
def find_union(segments, klass)
2018-12-05 23:21:45 +05:30
unless klass < FromUnion
raise TypeError, "#{klass.inspect} must include the FromUnion module"
end
2016-06-02 11:05:42 +05:30
2018-12-05 23:21:45 +05:30
if segments.length > 1
klass.from_union(segments)
2016-06-02 11:05:42 +05:30
else
segments.first
end
end
end