debian-mirror-gitlab/app/finders/union_finder.rb
2018-12-05 23:21:45 +05:30

15 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