<commit_before>module Arel
  module Predications
    def not_eq other
      Nodes::NotEqual.new self, quoted_node(other)
    end

    def not_eq_any others
      grouping_any :not_eq, others
    end

    def not_eq_all others
      grouping_all :not_eq, others
    end

    def eq other
      Nodes::Equality.new self, quoted_node(other)
    end

    def eq_any others
      grouping_any :eq, others
    end

    def eq_all others
      grouping_all :eq, quoted_array(others)
    end

    def between other
      if other.begin == -Float::INFINITY
        if other.end == Float::INFINITY
          not_in([])
        elsif other.exclude_end?
          lt(other.end)
        else
          lteq(other.end)
        end
      elsif other.end == Float::INFINITY
        gteq(other.begin)
      elsif other.exclude_end?
        gteq(other.begin).and(lt(other.end))
      else
        left = quoted_node(other.begin)
        right = quoted_node(other.end)
        Nodes::Between.new(self, left.and(right))
      end
    end

    def in other
      case other
      when Arel::SelectManager
        Arel::Nodes::In.new(self, other.ast)
      when Range
        if $VERBOSE
          warn <<-eowarn
Passing a range to `#in` is deprecated. Call `#between`, instead.
          eowarn
        end
        between(other)
      when Array
        Nodes::In.new self, quoted_array(other)
      else
        Nodes::In.new self, quoted_node(other)
      end
    end

    def in_any others
      grouping_any :in, others
    end

    def in_all others
      grouping_all :in, others
    end

    def not_between other
      if other.begin == -Float::INFINITY # The range begins with negative infinity
        if other.end == Float::INFINITY
          self.in([])
        elsif other.exclude_end?
          gteq(other.end)
        else
          gt(other.end)
        end
      elsif other.end == Float::INFINITY
        lt(other.begin)
      else
        left = lt(other.begin)
        right = if other.exclude_end?
          gteq(other.end)
        else
          gt(other.end)
        end
        left.or(right)
      end
    end

    def not_in other
      case other
      when Arel::SelectManager
        Arel::Nodes::NotIn.new(self, other.ast)
      when Range
        if $VERBOSE
          warn <<-eowarn
Passing a range to `#not_in` is deprecated. Call `#not_between`, instead.
          eowarn
        end
        not_between(other)
      when Array
        Nodes::NotIn.new self, quoted_array(other)<commit_msg>Look for `Enumerable` rather than `Array` in predicates<commit_after>module Arel
  module Predications
    def not_eq other
      Nodes::NotEqual.new self, quoted_node(other)
    end

    def not_eq_any others
      grouping_any :not_eq, others
    end

    def not_eq_all others
      grouping_all :not_eq, others
    end

    def eq other
      Nodes::Equality.new self, quoted_node(other)
    end

    def eq_any others
      grouping_any :eq, others
    end

    def eq_all others
      grouping_all :eq, quoted_array(others)
    end

    def between other
      if other.begin == -Float::INFINITY
        if other.end == Float::INFINITY
          not_in([])
        elsif other.exclude_end?
          lt(other.end)
        else
          lteq(other.end)
        end
      elsif other.end == Float::INFINITY
        gteq(other.begin)
      elsif other.exclude_end?
        gteq(other.begin).and(lt(other.end))
      else
        left = quoted_node(other.begin)
        right = quoted_node(other.end)
        Nodes::Between.new(self, left.and(right))
      end
    end

    def in other
      case other
      when Arel::SelectManager
        Arel::Nodes::In.new(self, other.ast)
      when Range
        if $VERBOSE
          warn <<-eowarn
Passing a range to `#in` is deprecated. Call `#between`, instead.
          eowarn
        end
        between(other)
      when Enumerable
        Nodes::In.new self, quoted_array(other)
      else
        Nodes::In.new self, quoted_node(other)
      end
    end

    def in_any others
      grouping_any :in, others
    end

    def in_all others
      grouping_all :in, others
    end

    def not_between other
      if other.begin == -Float::INFINITY # The range begins with negative infinity
        if other.end == Float::INFINITY
          self.in([])
        elsif other.exclude_end?
          gteq(other.end)
        else
          gt(other.end)
        end
      elsif other.end == Float::INFINITY
        lt(other.begin)
      else
        left = lt(other.begin)
        right = if other.exclude_end?
          gteq(other.end)
        else
          gt(other.end)
        end
        left.or(right)
      end
    end

    def not_in other
      case other
      when Arel::SelectManager
        Arel::Nodes::NotIn.new(self, other.ast)
      when Range
        if $VERBOSE
          warn <<-eowarn
Passing a range to `#not_in` is deprecated. Call `#not_between`, instead.
          eowarn
        end
        not_between(other)
      when Enumerable
        Nodes::NotIn.new self, quoted_array(other)
{'fraction_non_alphanumeric': 0.08260869565217391, 'fraction_numerical': 0.0, 'mean_word_length': 1.8464566929133859, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '322925', 'n_tokens_mistral': 1635, 'n_tokens_neox': 1571, 'n_words': 412}