Class: Tapioca::Gem::Pipeline
Constant Summary
collapse
- IGNORED_SYMBOLS =
T.let(["YAML", "MiniTest", "Mutex"], T::Array[String])
Runtime::Reflection::ANCESTORS_METHOD, Runtime::Reflection::CLASS_METHOD, Runtime::Reflection::CONSTANTS_METHOD, Runtime::Reflection::EQUAL_METHOD, Runtime::Reflection::METHOD_METHOD, Runtime::Reflection::NAME_METHOD, Runtime::Reflection::OBJECT_ID_METHOD, Runtime::Reflection::PRIVATE_INSTANCE_METHODS_METHOD, Runtime::Reflection::PROTECTED_INSTANCE_METHODS_METHOD, Runtime::Reflection::PUBLIC_INSTANCE_METHODS_METHOD, Runtime::Reflection::SINGLETON_CLASS_METHOD, Runtime::Reflection::SUPERCLASS_METHOD
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#compile ⇒ Object
-
#initialize(gem, include_doc: false) ⇒ Pipeline
constructor
A new instance of Pipeline.
-
#method_in_gem?(method) ⇒ Boolean
-
#name_of(constant) ⇒ Object
-
#push_const(symbol, constant, node) ⇒ Object
-
#push_constant(symbol, constant) ⇒ Object
-
#push_method(symbol, constant, node, signature, parameters) ⇒ Object
-
#push_scope(symbol, constant, node) ⇒ Object
-
#push_symbol(symbol) ⇒ Object
-
#symbol_in_payload?(symbol_name) ⇒ Boolean
Methods included from RBIHelper
#sanitize_signature_types
#ancestors_of, #are_equal?, #class_of, #constantize, #constants_of, #descendants_of, #inherited_ancestors_of, #method_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
Constructor Details
#initialize(gem, include_doc: false) ⇒ Pipeline
Returns a new instance of Pipeline.
Instance Attribute Details
#gem ⇒ Object
Returns the value of attribute gem.
16
17
18
|
# File 'lib/tapioca/gem/pipeline.rb', line 16
def gem
@gem
end
|
Instance Method Details
#compile ⇒ Object
48
49
50
51
|
# File 'lib/tapioca/gem/pipeline.rb', line 48
def compile
dispatch(next_event) until @events.empty?
@root
end
|
#method_in_gem?(method) ⇒ Boolean
94
95
96
97
98
99
|
# File 'lib/tapioca/gem/pipeline.rb', line 94
def method_in_gem?(method)
source_location = method.source_location&.first
return false if source_location.nil?
@gem.contains_path?(source_location)
end
|
#name_of(constant) ⇒ Object
102
103
104
105
106
107
108
109
110
|
# File 'lib/tapioca/gem/pipeline.rb', line 102
def name_of(constant)
name = name_of_proxy_target(constant, super(class_of(constant)))
return name if name
name = super(constant)
return if name.nil?
return unless are_equal?(constant, constantize(name, inherit: true))
name = "Struct" if name =~ /^(::)?Struct::[^:]+$/
name
end
|
#push_const(symbol, constant, node) ⇒ Object
64
65
66
|
# File 'lib/tapioca/gem/pipeline.rb', line 64
def push_const(symbol, constant, node)
@events << Gem::ConstNodeAdded.new(symbol, constant, node)
end
|
#push_constant(symbol, constant) ⇒ Object
59
60
61
|
# File 'lib/tapioca/gem/pipeline.rb', line 59
def push_constant(symbol, constant)
@events << Gem::ConstantFound.new(symbol, constant)
end
|
#push_method(symbol, constant, node, signature, parameters) ⇒ Object
82
83
84
|
# File 'lib/tapioca/gem/pipeline.rb', line 82
def push_method(symbol, constant, node, signature, parameters)
@events << Gem::MethodNodeAdded.new(symbol, constant, node, signature, parameters)
end
|
#push_scope(symbol, constant, node) ⇒ Object
69
70
71
|
# File 'lib/tapioca/gem/pipeline.rb', line 69
def push_scope(symbol, constant, node)
@events << Gem::ScopeNodeAdded.new(symbol, constant, node)
end
|
#push_symbol(symbol) ⇒ Object
54
55
56
|
# File 'lib/tapioca/gem/pipeline.rb', line 54
def push_symbol(symbol)
@events << Gem::SymbolFound.new(symbol)
end
|
#symbol_in_payload?(symbol_name) ⇒ Boolean
87
88
89
90
91
|
# File 'lib/tapioca/gem/pipeline.rb', line 87
def symbol_in_payload?(symbol_name)
symbol_name = symbol_name[2..-1] if symbol_name.start_with?("::")
return false unless symbol_name
@payload_symbols.include?(symbol_name)
end
|