Sha256: 69f34aa7cea4d647f287af28653fbc90fa63cd017cdca75e89c613a83f2bcdb8

Contents?: true

Size: 547 Bytes

Versions: 5

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true
module Arel
  module Visitors
    class WhereSql < Arel::Visitors::ToSql
      def initialize(inner_visitor, *args, &block)
        @inner_visitor = inner_visitor
        super(*args, &block)
      end

      private

      def visit_Arel_Nodes_SelectCore o, collector
        collector << "WHERE "
        wheres = o.wheres.map do |where|
          Nodes::SqlLiteral.new(@inner_visitor.accept(where, collector.class.new).value)
        end

        inject_join wheres, collector, ' AND '
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
spiral_form-0.1.1 vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/where_sql.rb
spiral_form-0.1.0 vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/where_sql.rb
nullifyable-0.1.0 vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/where_sql.rb
arel-9.0.0 lib/arel/visitors/where_sql.rb
arel-8.0.0 lib/arel/visitors/where_sql.rb