Skip to content

Commit

Permalink
Make module tracking lazy (#1978)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock authored Apr 26, 2024
1 parent 1639dd4 commit 9b31275
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions lib/ruby_indexer/lib/ruby_indexer/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,19 @@ class Namespace < Entry

abstract!

sig { returns(T::Array[String]) }
attr_accessor :included_modules
sig { returns(String) }
def short_name
T.must(@name.split("::").last)
end

sig { returns(T::Array[String]) }
attr_accessor :prepended_modules

sig do
params(
name: String,
file_path: String,
location: T.any(Prism::Location, RubyIndexer::Location),
comments: T::Array[String],
).void
end
def initialize(name, file_path, location, comments)
super(name, file_path, location, comments)
@included_modules = T.let([], T::Array[String])
@prepended_modules = T.let([], T::Array[String])
def included_modules
@included_modules ||= T.let([], T.nilable(T::Array[String]))
end

sig { returns(String) }
def short_name
T.must(@name.split("::").last)
sig { returns(T::Array[String]) }
def prepended_modules
@prepended_modules ||= T.let([], T.nilable(T::Array[String]))
end
end

Expand Down

0 comments on commit 9b31275

Please sign in to comment.