Sha256: c19c08d8603fb041ab7f0e41342a31bf6e67b08c9cd77c30b741ca8189ba6f35

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

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

module Arel
  module Nodes
    # https://www.postgresql.org/docs/10/functions-string.html
    class Overlaps < Arel::Nodes::Node
      attr_reader :start1
      attr_reader :end1
      attr_reader :start2
      attr_reader :end2

      def initialize(start1, end1, start2, end2)
        @start1 = start1
        @end1 = end1
        @start2 = start2
        @end2 = end2
      end
    end
  end

  module Visitors
    class ToSql
      def visit_Arel_Nodes_Overlaps(o, collector)
        collector << '('
        visit o.start1, collector
        collector << ', '
        visit o.end1, collector
        collector << ') OVERLAPS ('
        visit o.start2, collector
        collector << ', '
        visit o.end2, collector
        collector << ')'
      end
    end

    class Dot
      def visit_Arel_Nodes_Overlaps(o)
        visit_edge o, 'start1'
        visit_edge o, 'end1'
        visit_edge o, 'start2'
        visit_edge o, 'end2'
      end
    end
  end
end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arel_toolkit-0.4.6 lib/arel/extensions/overlaps.rb
arel_toolkit-0.4.5 lib/arel/extensions/overlaps.rb
arel_toolkit-0.4.4 lib/arel/extensions/overlaps.rb
arel_toolkit-0.4.3 lib/arel/extensions/overlaps.rb
arel_toolkit-0.4.2 lib/arel/extensions/overlaps.rb
arel_toolkit-0.4.1 lib/arel/extensions/overlaps.rb
arel_toolkit-0.4.0 lib/arel/extensions/overlaps.rb