Module: Tapioca::Runtime::Trackers::Mixin
- Extended by:
- T::Sig
- Defined in:
- lib/tapioca/runtime/trackers/mixin.rb
Defined Under Namespace
Classes: Type
Class Method Summary collapse
- .constants_with_mixin(mixin) ⇒ Object
- .register(constant, mixin, mixin_type) ⇒ Object
- .with_disabled_registration(&block) ⇒ Object
Class Method Details
.constants_with_mixin(mixin) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 55 def constants_with_mixin(mixin) @mixins_to_constants[mixin] ||= { Type::Prepend => {}.compare_by_identity, Type::Include => {}.compare_by_identity, Type::Extend => {}.compare_by_identity, } end |
.register(constant, mixin, mixin_type) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 45 def register(constant, mixin, mixin_type) return unless @enabled location = Reflection.resolve_loc(caller_locations) constants = constants_with_mixin(mixin) constants.fetch(mixin_type).store(constant, location) end |
.with_disabled_registration(&block) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 30 def with_disabled_registration(&block) @enabled = false block.call ensure @enabled = true end |