Module: Anthropic::Internal::Util::SorbetRuntimeSupport Private
- Included in:
- Helpers::Streaming, Anthropic::Internal, Transport::BaseClient, Transport::PooledNetRequester, Type::ArrayOf, Type::BaseModel, Type::Boolean, Type::Converter, Type::Enum, Type::HashOf, Type::Union, Type::Unknown
- Defined in:
- lib/anthropic/internal/util.rb,
sig/anthropic/internal/util.rbs
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
Class Method Summary collapse
- .to_sorbet_type(type) ⇒ Object private
Instance Method Summary collapse
- #const_missing(name) ⇒ void private
- #define_sorbet_constant!(name, &blk) { ... } ⇒ void private
- #sorbet_constant_defined?(name) ⇒ Boolean private
- #to_sorbet_type ⇒ Object private
Class Method Details
.to_sorbet_type(type) ⇒ 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.
974 975 976 977 978 979 980 981 982 983 984 985 |
# File 'lib/anthropic/internal/util.rb', line 974 def to_sorbet_type(type) case type in Anthropic::Internal::Util::SorbetRuntimeSupport type.to_sorbet_type in Class | Module type in true | false T::Boolean else type.class end end |
Instance Method Details
#const_missing(name) ⇒ void
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.
This method returns an undefined value.
939 940 941 942 943 944 945 946 947 948 |
# File 'lib/anthropic/internal/util.rb', line 939 def const_missing(name) super unless sorbet_runtime_constants.key?(name) unless Object.const_defined?(:T) = "Trying to access a Sorbet constant #{name.inspect} without `sorbet-runtime`." raise MissingSorbetRuntimeError.new() end sorbet_runtime_constants.fetch(name).call end |
#define_sorbet_constant!(name, &blk) { ... } ⇒ void
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.
This method returns an undefined value.
961 |
# File 'lib/anthropic/internal/util.rb', line 961 def define_sorbet_constant!(name, &blk) = sorbet_runtime_constants.store(name, blk) |
#sorbet_constant_defined?(name) ⇒ Boolean
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.
955 |
# File 'lib/anthropic/internal/util.rb', line 955 def sorbet_constant_defined?(name) = sorbet_runtime_constants.key?(name) |
#to_sorbet_type ⇒ 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.
966 |
# File 'lib/anthropic/internal/util.rb', line 966 def to_sorbet_type = raise NotImplementedError |