Sha256: bd8daaaeb8174dfb6df5747173b8a746bb620d94b46d1ca0f5978f6bcb9e475c

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module YARDSorbet
  module Handlers
    # Tracks modules that invoke `mixes_in_class_methods` for use in {IncludeHandler}
    # @see https://sorbet.org/docs/abstract#interfaces-and-the-included-hook
    #   Sorbet `mixes_in_class_methods` documentation
    class MixesInClassMethodsHandler < YARD::Handlers::Ruby::Base
      extend T::Sig

      handles method_call(:mixes_in_class_methods)
      namespace_only

      @@mix_in_class_methods = T.let({}, T::Hash[String, String]) # rubocop:disable Style/ClassVars

      sig { params(code_obj: String).returns(T.nilable(String)) }
      def self.mixed_in_class_methods(code_obj)
        @@mix_in_class_methods[code_obj]
      end

      sig { void }
      def process
        @@mix_in_class_methods[namespace.to_s] = statement.parameters(false)[0].source
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yard-sorbet-0.7.0 lib/yard-sorbet/handlers/mixes_in_class_methods_handler.rb
yard-sorbet-0.6.1 lib/yard-sorbet/handlers/mixes_in_class_methods_handler.rb