Module: FinchAPI::Internal::Util::SorbetRuntimeSupport Private

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: MissingSorbetRuntimeError

Instance Method Summary collapse

Instance Method Details

#const_missing(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • name (Symbol)


818
819
820
821
822
823
824
825
826
827
# File 'lib/finch_api/internal/util.rb', line 818

def const_missing(name)
  super unless sorbet_runtime_constants.key?(name)

  unless Object.const_defined?(:T)
    message = "Trying to access a Sorbet constant #{name.inspect} without `sorbet-runtime`."
    raise MissingSorbetRuntimeError.new(message)
  end

  sorbet_runtime_constants.fetch(name).call
end

#define_sorbet_constant!(name, &blk) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • name (Symbol)
  • blk (Proc)


833
# File 'lib/finch_api/internal/util.rb', line 833

def define_sorbet_constant!(name, &blk) = sorbet_runtime_constants.store(name, blk)