diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/collectors/bind.rb | 24 | ||||
-rw-r--r-- | lib/arel/collectors/composite.rb | 32 |
2 files changed, 56 insertions, 0 deletions
diff --git a/lib/arel/collectors/bind.rb b/lib/arel/collectors/bind.rb new file mode 100644 index 0000000000..d816aed90d --- /dev/null +++ b/lib/arel/collectors/bind.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Arel + module Collectors + class Bind + def initialize + @binds = [] + end + + def << str + self + end + + def add_bind bind + @binds << bind + self + end + + def value + @binds + end + end + end +end diff --git a/lib/arel/collectors/composite.rb b/lib/arel/collectors/composite.rb new file mode 100644 index 0000000000..4f6156fe27 --- /dev/null +++ b/lib/arel/collectors/composite.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Arel + module Collectors + class Composite + def initialize(left, right) + @left = left + @right = right + end + + def << str + left << str + right << str + self + end + + def add_bind bind, &block + left.add_bind bind, &block + right.add_bind bind, &block + self + end + + def value + [left.value, right.value] + end + + protected + + attr_reader :left, :right + end + end +end |