<commit_before># -*- encoding : utf-8 -*-
module Cequel
  module Metal
    #
    # Builder for `UPDATE` statement containing heterogeneous operations (set
    # columns, atomically mutate collections)
    #
    # @see DataSet#update
    # @see Deleter
    # @see
    #   http://cassandra.apache.org/doc/cql3/CQL.html#updateStmt
    #   CQL UPDATE documentation
    # @since 1.0.0
    #
    class Updater < Writer
      #
      # @see Writer#initialize
      #
      def initialize(*)
        @column_updates = {}
        super
      end

      #
      # Directly set column values
      #
      # @param data [Hash] map of column names to values
      # @return [void]
      #
      # @see DataSet#update
      #
      def set(data)
        data.each_pair do |column, value|
          column_updates[column.to_sym] = value
        end
      end

      #
      # Prepend elements to a list column
      #
      # @param column [Symbol] column name
      # @param elements [Array<Object>] elements to prepend
      # @return [void]
      #
      # @see DataSet#list_prepend
      #
      def list_prepend(column, elements)
        statements << "#{column} = [?] + #{column}"
        bind_vars << if elements.is_a?(Array)
                       elements.reverse
                     else
                       elements
                     end
      end

      #
      # Append elements to a list column
      #<commit_msg>Remove elements reverse from updater<commit_after># -*- encoding : utf-8 -*-
module Cequel
  module Metal
    #
    # Builder for `UPDATE` statement containing heterogeneous operations (set
    # columns, atomically mutate collections)
    #
    # @see DataSet#update
    # @see Deleter
    # @see
    #   http://cassandra.apache.org/doc/cql3/CQL.html#updateStmt
    #   CQL UPDATE documentation
    # @since 1.0.0
    #
    class Updater < Writer
      #
      # @see Writer#initialize
      #
      def initialize(*)
        @column_updates = {}
        super
      end

      #
      # Directly set column values
      #
      # @param data [Hash] map of column names to values
      # @return [void]
      #
      # @see DataSet#update
      #
      def set(data)
        data.each_pair do |column, value|
          column_updates[column.to_sym] = value
        end
      end

      #
      # Prepend elements to a list column
      #
      # @param column [Symbol] column name
      # @param elements [Array<Object>] elements to prepend
      # @return [void]
      #
      # @see DataSet#list_prepend
      #
      def list_prepend(column, elements)
        statements << "#{column} = [?] + #{column}"
        bind_vars << elements
      end

      #
      # Append elements to a list column
      #
{'fraction_non_alphanumeric': 0.09647835656639765, 'fraction_numerical': 0.003668378576669112, 'mean_word_length': 1.7053571428571428, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 5, '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': '5295434', 'n_tokens_mistral': 812, 'n_tokens_neox': 798, 'n_words': 215}