Module: T::Private::Sealed::NoIncludeExtend
- Defined in:
- lib/types/private/sealed.rb
Instance Method Summary collapse
Instance Method Details
#extended(child) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/types/private/sealed.rb', line 30 def extended(child) super caller_loc = T::Private::CallerUtils.find_caller {|loc| !loc.to_s.match(/in `extended'$/)} T::Private::Sealed.validate_inheritance(caller_loc, self, child, 'extended') @sorbet_sealed_module_all_subclasses << child end |
#included(child) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/types/private/sealed.rb', line 23 def included(child) super caller_loc = T::Private::CallerUtils.find_caller {|loc| !loc.to_s.match(/in `included'$/)} T::Private::Sealed.validate_inheritance(caller_loc, self, child, 'included') @sorbet_sealed_module_all_subclasses << child end |
#sealed_subclasses ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/types/private/sealed.rb', line 37 def sealed_subclasses # this will freeze the set so that you can never get into a # state where you use the subclasses list and then something # else will add to it @sorbet_sealed_module_all_subclasses_set ||= # rubocop:disable Naming/MemoizedInstanceVariableName begin require 'set' Set.new(@sorbet_sealed_module_all_subclasses).freeze end end |