gitlab-org--gitlab-foss/app/finders/union_finder.rb

16 lines
305 B
Ruby

# frozen_string_literal: true
class UnionFinder
def find_union(segments, klass)
unless klass < FromUnion
raise TypeError, "#{klass.inspect} must include the FromUnion module"
end
if segments.length > 1
klass.from_union(segments)
else
segments.first
end
end
end