Class: Anthropic::Internal::Type::Boolean Abstract Private

Inherits:
Object
  • Object
show all
Extended by:
Converter, Util::SorbetRuntimeSupport
Defined in:
lib/anthropic/internal/type/boolean.rb

Overview

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

This class is abstract.

Ruby has no Boolean class; this is something for models to refer to.

Direct Known Subclasses

Helpers::InputSchema::Boolean

Class Method Summary collapse

Methods included from Converter

coerce, dump, inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Util::SorbetRuntimeSupport

const_missing, define_sorbet_constant!, sorbet_constant_defined?, to_sorbet_type

Class Method Details

.==(other) ⇒ Boolean

Parameters:

  • other (Object)

Returns:



29
# File 'lib/anthropic/internal/type/boolean.rb', line 29

def self.==(other) = other.is_a?(Class) && other <= Anthropic::Internal::Type::Boolean

.===(other) ⇒ Boolean

Parameters:

  • other (Object)

Returns:



22
# File 'lib/anthropic/internal/type/boolean.rb', line 22

def self.===(other) = other == true || other == false

.coerce(value, state:) ⇒ Boolean, 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.

Coerce value to Boolean if possible, otherwise return the original value.

Parameters:

  • value (Boolean, Object)
  • state (Hash{Symbol=>Object})

    .

    @option state [Boolean] :translate_names

    @option state [Boolean] :strictness

    @option state [HashSymbol=>Object] :exactness

    @option state [Class<StandardError>] :error

    @option state [Integer] :branched

Returns:



51
52
53
54
# File 'lib/anthropic/internal/type/boolean.rb', line 51

def coerce(value, state:)
  state.fetch(:exactness)[value == true || value == false ? :yes : :no] += 1
  value
end

.dump(value, state: ) ⇒ Boolean, 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:

  • value (Boolean, Object)
  • state (Hash{Symbol=>Object}) (defaults to: )

    .

    @option state [Boolean] :can_retry

Returns:



# File 'lib/anthropic/internal/type/boolean.rb', line 56

.to_sorbet_typeObject

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.

Returns:

  • (Object)


70
71
72
# File 'lib/anthropic/internal/type/boolean.rb', line 70

def to_sorbet_type
  T::Boolean
end