2017-07-21 09:41:07 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-24 02:41:47 -05:00
|
|
|
module Arel # :nodoc: all
|
2017-07-21 09:41:07 -04:00
|
|
|
module Collectors
|
|
|
|
class Composite
|
|
|
|
def initialize(left, right)
|
|
|
|
@left = left
|
|
|
|
@right = right
|
|
|
|
end
|
|
|
|
|
2018-02-24 01:45:50 -05:00
|
|
|
def <<(str)
|
2017-07-21 09:41:07 -04:00
|
|
|
left << str
|
|
|
|
right << str
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2018-02-24 01:45:50 -05:00
|
|
|
def add_bind(bind, &block)
|
2017-07-21 09:41:07 -04:00
|
|
|
left.add_bind bind, &block
|
|
|
|
right.add_bind bind, &block
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def value
|
|
|
|
[left.value, right.value]
|
|
|
|
end
|
|
|
|
|
2018-09-30 02:24:17 -04:00
|
|
|
private
|
2018-02-24 01:45:50 -05:00
|
|
|
attr_reader :left, :right
|
2017-07-21 09:41:07 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|