<commit_before># frozen_string_literal: true

module Arel # :nodoc: all
  module Nodes
    class Casted < Arel::Nodes::NodeExpression # :nodoc:
      attr_reader :value, :attribute
      alias :value_before_type_cast :value

      def initialize(value, attribute)
        @value     = value
        @attribute = attribute
        super()
      end

      def nil?; value.nil?; end

      def value_for_database
        if attribute.able_to_type_cast?
          attribute.type_cast_for_database(value)
        else
          value
        end
      end

      def hash
        [self.class, value, attribute].hash
      end

      def eql?(other)
        self.class == other.class &&
          self.value == other.value &&
          self.attribute == other.attribute
      end
      alias :== :eql?
    end

    class Quoted < Arel::Nodes::Unary # :nodoc:
      alias :value_for_database :value
      alias :value_before_type_cast :value

      def nil?; value.nil?; end

      def infinite?
        value.respond_to?(:infinite?) && value.infinite?
      end
    end

    def self.build_quoted(other, attribute = nil)
      case other
      when Arel::Nodes::Node, Arel::Attributes::Attribute, Arel::Table, Arel::Nodes::BindParam, Arel::SelectManager, Arel::Nodes::Quoted, Arel::Nodes::SqlLiteral
        other
      else
        case attribute
        when Arel::Attributes::Attribute<commit_msg>`Arel::Nodes::BindParam` and `Arel::Nodes::Quoted` are a subclass of the `Arel::Nodes::Node`<commit_after># frozen_string_literal: true

module Arel # :nodoc: all
  module Nodes
    class Casted < Arel::Nodes::NodeExpression # :nodoc:
      attr_reader :value, :attribute
      alias :value_before_type_cast :value

      def initialize(value, attribute)
        @value     = value
        @attribute = attribute
        super()
      end

      def nil?; value.nil?; end

      def value_for_database
        if attribute.able_to_type_cast?
          attribute.type_cast_for_database(value)
        else
          value
        end
      end

      def hash
        [self.class, value, attribute].hash
      end

      def eql?(other)
        self.class == other.class &&
          self.value == other.value &&
          self.attribute == other.attribute
      end
      alias :== :eql?
    end

    class Quoted < Arel::Nodes::Unary # :nodoc:
      alias :value_for_database :value
      alias :value_before_type_cast :value

      def nil?; value.nil?; end

      def infinite?
        value.respond_to?(:infinite?) && value.infinite?
      end
    end

    def self.build_quoted(other, attribute = nil)
      case other
      when Arel::Nodes::Node, Arel::Attributes::Attribute, Arel::Table, Arel::SelectManager, Arel::Nodes::SqlLiteral
        other
      else
        case attribute
        when Arel::Attributes::Attribute
{'fraction_non_alphanumeric': 0.09985835694050992, 'fraction_numerical': 0.0, 'mean_word_length': 2.33530106257379, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4537839', 'n_tokens_mistral': 837, 'n_tokens_neox': 826, 'n_words': 203}