<commit_before># encoding: utf-8

module Veritas
  class Optimizer
    module Relation
      module Operation

        # Abstract base class representing Difference optimizations
        class Insertion < Relation::Operation::Binary

          # Optimize when the left operand is a rename
          class RenameLeft < self

            # Test if the left operand is a Rename
            #
            # @return [Boolean]
            #
            # @api private
            def optimizable?
              left.kind_of?(Veritas::Algebra::Rename)
            end

            # An Insertion into a Rename applies to the Rename operand
            #
            # Push-down the insertion to apply to the rename operand, and make
            # sure the inserted tuples are properly renamed to match the
            # operand. Apply the rename to the insertion.
            #
            # @return [Veritas::Algebra::Rename]
            #
            # @api private
            def optimize
              unwrap_left.insert(rename_right).rename(aliases)
            end

          private

            # Unwrap the operand from the left relation
            #
            # @return [Relation]<commit_msg>Update YARD doc to be more clear<commit_after># encoding: utf-8

module Veritas
  class Optimizer
    module Relation
      module Operation

        # Abstract base class representing Difference optimizations
        class Insertion < Relation::Operation::Binary

          # Optimize when the left operand is a rename
          class RenameLeft < self

            # Test if the left operand is a Rename
            #
            # @return [Boolean]
            #
            # @api private
            def optimizable?
              left.kind_of?(Veritas::Algebra::Rename)
            end

            # An Insertion into a Rename applies to its operand
            #
            # Push-down the insertion to apply to the rename operand, and make
            # sure the inserted tuples are properly renamed to match the
            # operand. Apply the rename to the insertion.
            #
            # @return [Veritas::Algebra::Rename]
            #
            # @api private
            def optimize
              unwrap_left.insert(rename_right).rename(aliases)
            end

          private

            # Unwrap the operand from the left relation
            #
            # @return [Relation]
{'fraction_non_alphanumeric': 0.05394190871369295, 'fraction_numerical': 0.0008298755186721991, 'mean_word_length': 1.5219665271966527, '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': '5212561', 'n_tokens_mistral': 579, 'n_tokens_neox': 570, 'n_words': 210}