Skip to content

Commit

Permalink
Call to_a on cached object space enumerator
Browse files Browse the repository at this point in the history
  • Loading branch information
warhammerkid committed Nov 14, 2024
1 parent 16e6cd9 commit 2dfbfa4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/tapioca/dsl/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ def descendants_of(klass)
sig { returns(T::Enumerable[T::Class[T.anything]]) }
def all_classes
@all_classes ||= T.let(
if @@requested_constants.any?
@@requested_constants.grep(Class)
else
ObjectSpace.each_object(Class)
end,
all_modules.grep(Class).freeze,
T.nilable(T::Enumerable[T::Class[T.anything]]),
)
end
Expand All @@ -87,10 +83,10 @@ def all_classes
def all_modules
@all_modules ||= T.let(
if @@requested_constants.any?
@@requested_constants.select { |k| k.is_a?(Module) }
@@requested_constants.grep(Module)
else
ObjectSpace.each_object(Module)
end,
ObjectSpace.each_object(Module).to_a
end.freeze,
T.nilable(T::Enumerable[Module]),
)
end
Expand Down

0 comments on commit 2dfbfa4

Please sign in to comment.