Module: Tapioca::Runtime::Trackers::MethodDefinition
- Extended by:
- T::Sig, Tracker
- Defined in:
- lib/tapioca/runtime/trackers/method_definition.rb
Class Method Summary collapse
-
.method_definitions_for(method_name, owner) ⇒ Object
: (Symbol method_name, Module owner) -> Array.
-
.register(method_name, owner, locations) ⇒ Object
: (Symbol method_name, Module owner, Array locations) -> void.
Methods included from Tracker
disable!, enabled?, extended, with_disabled_tracker
Class Method Details
.method_definitions_for(method_name, owner) ⇒ Object
: (Symbol method_name, Module owner) -> Array
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/tapioca/runtime/trackers/method_definition.rb', line 29 def method_definitions_for(method_name, owner) definitions = registrations_for(method_name, owner) if definitions.empty? source_loc = owner.instance_method(method_name).source_location definitions = [SourceLocation.from_loc(source_loc)].compact end definitions end |
.register(method_name, owner, locations) ⇒ Object
: (Symbol method_name, Module owner, Array locations) -> void
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tapioca/runtime/trackers/method_definition.rb', line 15 def register(method_name, owner, locations) return unless enabled? # If Sorbet runtime is redefining a method, it sets this to true. # In those cases, we should skip the registration, as the method's original # definition should already be registered. return if T::Private::DeclState.current.skip_on_method_added loc = Reflection.resolve_loc(locations) return unless loc registrations_for(method_name, owner) << loc end |