Class: UnionFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/union_finder.rb

Instance Method Summary collapse

Instance Method Details

#find_union(segments, klass) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/finders/union_finder.rb', line 4

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