Sha256: 2070ae583d9e3c073f1220f7bc896ecaa3cd7fb1a4376c8c2e0d7b7fe38d9e11

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true
# typed: strict

# Used as a mixin to any class so that you can call `sig`.
# Docs at https://sorbet.org/docs/sigs
module T::Sig
  module WithoutRuntime
    # At runtime, does nothing, but statically it is treated exactly the same
    # as T::Sig#sig. Only use it in cases where you can't use T::Sig#sig.
    def self.sig(&blk); end # rubocop:disable PrisonGuard/BanBuiltinMethodOverride

    original_verbose = $VERBOSE
    $VERBOSE = false

    # At runtime, does nothing, but statically it is treated exactly the same
    # as T::Sig#sig. Only use it in cases where you can't use T::Sig#sig.
    T::Sig::WithoutRuntime.sig {params(blk: T.proc.bind(T::Private::Methods::DeclBuilder).void).void}
    def self.sig(&blk); end # rubocop:disable PrisonGuard/BanBuiltinMethodOverride, Lint/DuplicateMethods

    $VERBOSE = original_verbose
  end

  # Declares a method with type signatures and/or
  # abstract/override/... helpers. See the documentation URL on
  # {T::Helpers}
  T::Sig::WithoutRuntime.sig {params(blk: T.proc.bind(T::Private::Methods::DeclBuilder).void).void}
  def sig(&blk) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
    T::Private::Methods.declare_sig(self, &blk)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sorbet-runtime-0.4.4442 lib/types/sig.rb
sorbet-runtime-0.4.4440 lib/types/sig.rb
sorbet-runtime-0.4.4439 lib/types/sig.rb
sorbet-runtime-0.4.4438 lib/types/sig.rb
sorbet-runtime-0.4.4437 lib/types/sig.rb
sorbet-runtime-0.4.4436 lib/types/sig.rb
sorbet-runtime-0.4.4435 lib/types/sig.rb
sorbet-runtime-0.4.4433 lib/types/sig.rb