Sha256: ba2b8cea10670d385a50a2b39ef1ee7bca8dd370ee18b938bc6a11b79662f764
Contents?: true
Size: 1.04 KB
Versions: 8
Compression:
Stored size: 1.04 KB
Contents
# typed: strict # frozen_string_literal: true module Tapioca module Gem module Listeners class Subconstants < Base extend T::Sig include Runtime::Reflection private sig { override.params(event: ScopeNodeAdded).void } def on_scope(event) symbol = event.symbol return if @pipeline.symbol_in_payload?(symbol) && event.node.empty? prefix = symbol == "Object" ? "" : symbol constant = event.constant constants_of(constant).sort.uniq.map do |constant_name| name = "#{prefix}::#{constant_name}" subconstant = constantize(name) # Don't compile modules of Object because Object::Foo == Foo # Don't compile modules of BasicObject because BasicObject::BasicObject == BasicObject next if (Object == constant || BasicObject == constant) && Module === subconstant next unless subconstant @pipeline.push_constant(name, subconstant) end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems