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
52 53 54 55 56 57 58 |
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 52 def self.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
42 43 44 45 46 47 48 49 |
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 42 def self.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
27 28 29 30 31 32 33 |
# File 'lib/tapioca/runtime/trackers/mixin.rb', line 27 def self.with_disabled_registration(&block) @enabled = false block.call ensure @enabled = true end |