Module: Tapioca::ConstantLocator

Extended by:
Reflection
Defined in:
lib/tapioca/constant_locator.rb

Overview

Registers a TracePoint immediately upon load to track points at which classes and modules are opened for definition. This is used to track correspondence between classes/modules and files, as this information isn't available in the ruby runtime without extra accounting.

Constant Summary

Constants included from Reflection

Reflection::ANCESTORS_METHOD, Reflection::CLASS_METHOD, Reflection::CONSTANTS_METHOD, Reflection::EQUAL_METHOD, Reflection::METHOD_METHOD, Reflection::NAME_METHOD, Reflection::OBJECT_ID_METHOD, Reflection::PRIVATE_INSTANCE_METHODS_METHOD, Reflection::PROTECTED_INSTANCE_METHODS_METHOD, Reflection::PUBLIC_INSTANCE_METHODS_METHOD, Reflection::SINGLETON_CLASS_METHOD, Reflection::SUPERCLASS_METHOD

Class Method Summary collapse

Methods included from Reflection

ancestors_of, are_equal?, class_of, constants_of, descendants_of, inherited_ancestors_of, method_of, name_of, name_of_type, object_id_of, private_instance_methods_of, protected_instance_methods_of, public_instance_methods_of, qualified_name_of, signature_of, singleton_class_of, superclass_of

Class Method Details

.files_for(klass) ⇒ Object

Returns the files in which this class or module was opened. Doesn't know about situations where the class was opened prior to +require+ing, or where metaprogramming was used via eval, etc.



34
35
36
37
38
# File 'lib/tapioca/constant_locator.rb', line 34

def self.files_for(klass)
  name = String === klass ? klass : name_of(klass)
  files = @class_files[name]
  files || Set.new
end