Sha256: 3a7438b09c335e1a4fcba9278bdf66a2fb68b6faf0502063754df3a442daf89a

Contents?: true

Size: 949 Bytes

Versions: 5

Compression:

Stored size: 949 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module RubyIndexer
  # Represents the visibility scope in a Ruby namespace. This keeps track of whether methods are in a public, private or
  # protected section, and whether they are module functions.
  class VisibilityScope
    extend T::Sig

    class << self
      extend T::Sig

      sig { returns(T.attached_class) }
      def module_function_scope
        new(module_func: true, visibility: Entry::Visibility::PRIVATE)
      end

      sig { returns(T.attached_class) }
      def public_scope
        new
      end
    end

    sig { returns(Entry::Visibility) }
    attr_reader :visibility

    sig { returns(T::Boolean) }
    attr_reader :module_func

    sig { params(visibility: Entry::Visibility, module_func: T::Boolean).void }
    def initialize(visibility: Entry::Visibility::PUBLIC, module_func: false)
      @visibility = visibility
      @module_func = module_func
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-lsp-0.23.6 lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb
ruby-lsp-0.23.5 lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb
ruby-lsp-0.23.4 lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb
ruby-lsp-0.23.3 lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb
ruby-lsp-0.23.2 lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb