module T::Helpers

Use as a mixin with extend (`extend T::Helpers`). Docs at confluence.corp.stripe.com/display/PRODINFRA/Ruby+Types

Constants

Private

Public Instance Methods

abstract!() click to toggle source

Class/Module Helpers ###

# File lib/types/helpers.rb, line 11
def abstract!
  Private::Abstract::Declare.declare_abstract(self, type: :abstract)
end
final!() click to toggle source
# File lib/types/helpers.rb, line 19
def final!
  Private::Final.declare(self)
end
interface!() click to toggle source
# File lib/types/helpers.rb, line 15
def interface!
  Private::Abstract::Declare.declare_abstract(self, type: :interface)
end
mixes_in_class_methods(mod, *mods) click to toggle source

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.

# File lib/types/helpers.rb, line 36
def mixes_in_class_methods(mod, *mods)
  Private::Mixins.declare_mixes_in_class_methods(self, [mod].concat(mods))
end
requires_ancestor(mod, *mods) click to toggle source

Specify an inclusion or inheritance requirement for `self`.

Example:

module MyHelper
  extend T::Helpers

  requires_ancestor Kernel
end

class MyClass < BasicObject # error: `MyClass` must include `Kernel` (required by `MyHelper`)
  include MyHelper
end

TODO: implement the checks in sorbet-runtime.

# File lib/types/helpers.rb, line 55
def requires_ancestor(mod, *mods); end
sealed!() click to toggle source
# File lib/types/helpers.rb, line 23
def sealed!
  Private::Sealed.declare(self, Kernel.caller(1..1)&.first&.split(':')&.first)
end