Sha256: 3f9cb8903bfa394345077ec34be978f8d692c96d8660c10247e3fe77e862faee

Contents?: true

Size: 781 Bytes

Versions: 1

Compression:

Stored size: 781 Bytes

Contents

# rubocop:disable Naming/MethodName
# rubocop:disable Naming/UncommunicativeMethodParamName

module Arel
  module Nodes
    # https://www.postgresql.org/docs/9.1/functions-string.html#FUNCTIONS-STRING-SQL
    class Position < Arel::Nodes::Node
      attr_reader :substring
      attr_reader :string

      def initialize(substring, string)
        @substring = substring
        @string = string
      end
    end
  end

  module Visitors
    class ToSql
      def visit_Arel_Nodes_Position(o, collector)
        collector << 'position('
        visit o.substring, collector
        collector << ' in '
        visit o.string, collector
        collector << ')'
      end
    end
  end
end

# rubocop:enable Naming/MethodName
# rubocop:enable Naming/UncommunicativeMethodParamName

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arel_toolkit-0.3.0 lib/arel/extensions/position.rb