Module: T::Helpers
- Extended by:
- Sig
- Included in:
- Generic, Props, Props::ClassMethods, Props::CustomType, Props::Plugin, Props::Private::ApplyDefault
- Defined in:
- lib/types/helpers.rb,
lib/sorbet-runtime.rb
Overview
Use as a mixin with extend (`extend T::Helpers`). Docs at confluence.corp.stripe.com/display/PRODINFRA/Ruby+Types
Constant Summary collapse
Instance Method Summary collapse
-
#abstract! ⇒ Object
Class/Module Helpers ###.
- #final! ⇒ Object
- #interface! ⇒ Object
-
#mixes_in_class_methods(mod, *mods) ⇒ Object
Causes a mixin to also mix in class methods from the named module.
-
#requires_ancestor(&block) ⇒ Object
Specify an inclusion or inheritance requirement for `self`.
- #sealed! ⇒ Object
Methods included from Sig
Instance Method Details
#abstract! ⇒ Object
Class/Module Helpers ###
13 14 15 |
# File 'lib/types/helpers.rb', line 13 def abstract! Private::Abstract::Declare.declare_abstract(self, type: :abstract) end |
#final! ⇒ Object
21 22 23 |
# File 'lib/types/helpers.rb', line 21 def final! Private::Final.declare(self) end |
#interface! ⇒ Object
17 18 19 |
# File 'lib/types/helpers.rb', line 17 def interface! Private::Abstract::Declare.declare_abstract(self, type: :interface) end |
#mixes_in_class_methods(mod, *mods) ⇒ Object
Causes a mixin to also mix in class methods from the named module.
Nearly equivalent to
def self.included(other)
other.extend(mod)
end
Except that it is statically analyzed by sorbet.
38 39 40 |
# File 'lib/types/helpers.rb', line 38 def mixes_in_class_methods(mod, *mods) Private::Mixins.declare_mixes_in_class_methods(self, [mod].concat(mods)) end |
#requires_ancestor(&block) ⇒ Object
57 |
# File 'lib/types/helpers.rb', line 57 def requires_ancestor(&block); end |
#sealed! ⇒ Object
25 26 27 |
# File 'lib/types/helpers.rb', line 25 def sealed! Private::Sealed.declare(self, Kernel.caller(1..1)&.first&.split(':')&.first) end |