You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: changelog_pruner.rb
    path of file: ./repos/dependabot-core/common/lib/dependabot/metadata_finders/base
    
    the code of the file until where you have to start completion: # typed: strict
# frozen_string_literal: true

require "sorbet-runtime"
require "dependabot/metadata_finders/base"

module Dependabot
  module MetadataFinders
    class Base
      class ChangelogPruner
        extend T::Sig

        sig { returns(Dependabot::Dependency) }
        attr_reader :dependency

        sig { returns(T.nilable(String)) }
        attr_reader :changelog_text

        sig do
          params(
            dependency: Dependabot::Dependency,
            changelog_text: T.nilable(String)
          )
            .void
        end
        def initialize(dependency:, changelog_text:)
          @dependency = dependency
          @changelog_text = changelog_text
        end

        sig { returns(T::Boolean) }
        def includes_new_version?
          !new_version_changelog_line.nil?
        end

        sig { returns(T::Boolean) }
        def includes_previous_version?
          !old_version_changelog_line.nil?
        end

        sig { returns(T.nilable(String)) }
        def pruned_text # rubocop:disable Metrics/PerceivedComplexity
          changelog_lines = changelog_text&.split("\n")

          slice_range =
            i
    
        def previous_ref
          previous_refs = T.must(dependency.previous_requirements).filter_map do |r|
            r.dig(:source, "ref") || r.dig(:source, :ref)
          end.uniq
          previous_refs.first if previous_refs.count == 1
        end

        sig { returns(T.nilable(String)) }
        def new_ref
          new_refs = dependency.requirements.filter_map do |r|
            r.dig(:source, "ref") || r.dig(:source, :ref)
          end.uniq
          new_refs.first if new_refs.count == 1
        end

        # TODO: Refactor me so that Composer doesn't need to be special cased
        sig { returns(T::Boolean) }
        def git_source?
          # Special case Composer, which uses git as a source but handles tags
          # internally
          return false if dependency.package_manager == "composer"

          requirements = dependency.requirements
          sources = requirements.map { |r| r.fetch(:source) }.uniq.compact
          return false if sources.empty?

          sources.all? { |s| s[:type] == "git" || s["type"] == "git" }
        end

        sig { returns(T.class_of(Dependabot::Version)) }
        def version_class
          dependency.version_class
        end
      end
    end
  end