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

16 lines
305 B
Ruby
Raw Normal View History

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