4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/pacer/transform/make_pairs.rb', line 4
def make_pairs(other = nil, &block)
if block
fail 'not implemented yet'
elsif other
if other.is_a? Route and [element_type, other.element_type].all? { |t| [:vertex, :edge].include? t }
et = :path
else
et = :object
end
other = other.to_a
if other.empty?
empty(self)
else
flat_map(element_type: et, route_name: 'make_pairs') do |el|
other.map { |o| [el, o] }
end
end
else
fail Pacer::ClientError, 'No source for pairs given to make_pairs'
end
end
|