Sha256: 28c7a8a09271416286d11fbeb665c0e73b904e3e3c2f7cead79b28134f4f7919

Contents?: true

Size: 971 Bytes

Versions: 3

Compression:

Stored size: 971 Bytes

Contents

require 'arel/visitors/visitor'
module Arel
  module Visitors
    class Visitor
      # We are adding our visitors to the main visitor for the time being until the right spot is found to monkey patch
      private
      def visit_Arel_Nodes_ContainedWithin o
        "#{visit o.left} << #{visit o.right}"
      end

      def visit_Arel_Nodes_ContainedWithinEquals o
        "#{visit o.left} <<= #{visit o.right}"
      end

      def visit_Arel_Nodes_Contains o
        "#{visit o.left} >> #{visit o.right}"
      end

      def visit_Arel_Nodes_ContainsEquals o
        "#{visit o.left} >>= #{visit o.right}"
      end

      def visit_Arel_Nodes_ArrayOverlap o
        if Array === o.right
          "#{visit o.left} && #{visit o.right}"
        else
          "#{visit o.left} && #{visit o.right}"
        end
      end

      def visit_IPAddr value
        "'#{value.to_s}/#{value.instance_variable_get(:@mask_addr).to_s(2).count('1')}'"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
postgres_ext-0.2.2 lib/postgres_ext/arel/visitors/visitor.rb
postgres_ext-0.2.1 lib/postgres_ext/arel/visitors/visitor.rb
postgres_ext-0.2.0 lib/postgres_ext/arel/visitors/visitor.rb