Module: Tapioca::Runtime::Trackers::Mixin
- Extended by:
- T::Sig, Tracker
- Defined in:
- lib/tapioca/runtime/trackers/mixin.rb
Defined Under Namespace
Classes: Type
Class Method Summary
collapse
Methods included from Tracker
disable!, enabled?, extended, with_disabled_tracker
Class Method Details
.constants_with_mixin(mixin) ⇒ Object
56
57
58
|
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 56
def constants_with_mixin(mixin)
find_or_initialize_mixin_lookup(mixin)
end
|
.mixin_location(mixin, mixin_type, constant) ⇒ Object
61
62
63
|
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 61
def mixin_location(mixin, mixin_type, constant)
find_or_initialize_mixin_lookup(mixin).dig(mixin_type, constant)
end
|
.register(constant, mixin, mixin_type) ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 35
def register(constant, mixin, mixin_type)
return unless enabled?
location = Reflection.resolve_loc(caller_locations)
register_with_location(constant, mixin, mixin_type, location)
end
|
.resolve_to_attached_class(constant, mixin, mixin_type) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 43
def resolve_to_attached_class(constant, mixin, mixin_type)
attached_class = Reflection.attached_class_of(constant)
return unless attached_class
if mixin_type == Type::Include || mixin_type == Type::Prepend
location = mixin_location(mixin, mixin_type, constant)
register_with_location(constant, mixin, Type::Extend, T.must(location))
end
attached_class
end
|
.with_disabled_registration(&block) ⇒ Object
30
31
32
|
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 30
def with_disabled_registration(&block)
with_disabled_tracker(&block)
end
|