Module: Lithic::Internal::Type::Enum Private

Includes:
Converter, Util::SorbetRuntimeSupport
Included in:
Models::Account::State, Models::Account::Substatus, Models::AccountActivityListParams::Category, Models::AccountActivityListParams::Result, Models::AccountActivityListParams::Status, Models::AccountActivityListResponse::Card::Status, Models::AccountActivityListResponse::Internal::Category, Models::AccountActivityListResponse::Internal::Result, Models::AccountActivityListResponse::Internal::Status, Models::AccountActivityRetrieveTransactionResponse::Card::Status, Models::AccountActivityRetrieveTransactionResponse::Internal::Category, Models::AccountActivityRetrieveTransactionResponse::Internal::Result, Models::AccountActivityRetrieveTransactionResponse::Internal::Status, Models::AccountFinancialAccountType, Models::AccountHolder::ExemptionType, Models::AccountHolder::Status, Models::AccountHolder::StatusReason, Models::AccountHolder::UserType, Models::AccountHolder::VerificationApplication::Status, Models::AccountHolder::VerificationApplication::StatusReason, Models::AccountHolderCreateParams::KYCExemptionType, Models::AccountHolderCreateParams::Workflow, Models::AccountHolderCreateResponse::Status, Models::AccountHolderCreateResponse::StatusReason, Models::AccountHolderCreatedWebhookEvent::Status, Models::AccountHolderDocumentUpdatedWebhookEvent::DocumentType, Models::AccountHolderDocumentUpdatedWebhookEvent::RequiredDocumentUpload::ImageType, Models::AccountHolderDocumentUpdatedWebhookEvent::RequiredDocumentUpload::Status, Models::AccountHolderSimulateEnrollmentDocumentReviewParams::Status, Models::AccountHolderSimulateEnrollmentDocumentReviewParams::StatusReason, Models::AccountHolderSimulateEnrollmentReviewParams::Status, Models::AccountHolderSimulateEnrollmentReviewParams::StatusReason, Models::AccountHolderSimulateEnrollmentReviewResponse::ExemptionType, Models::AccountHolderSimulateEnrollmentReviewResponse::Status, Models::AccountHolderSimulateEnrollmentReviewResponse::StatusReason, Models::AccountHolderSimulateEnrollmentReviewResponse::UserType, Models::AccountHolderSimulateEnrollmentReviewResponse::VerificationApplication::Status, Models::AccountHolderSimulateEnrollmentReviewResponse::VerificationApplication::StatusReason, Models::AccountHolderUpdateResponse::KYBKYCPatchResponse::ExemptionType, Models::AccountHolderUpdateResponse::KYBKYCPatchResponse::Status, Models::AccountHolderUpdateResponse::KYBKYCPatchResponse::StatusReason, Models::AccountHolderUpdateResponse::KYBKYCPatchResponse::UserType, Models::AccountHolderUpdateResponse::KYBKYCPatchResponse::VerificationApplication::Status, Models::AccountHolderUpdateResponse::KYBKYCPatchResponse::VerificationApplication::StatusReason, Models::AccountHolderUpdatedWebhookEvent::KYBPayload::EventType, Models::AccountHolderUpdatedWebhookEvent::KYCPayload::EventType, Models::AccountHolderUpdatedWebhookEvent::LegacyPayload::EventType, Models::AccountHolderUploadDocumentParams::DocumentType, Models::AccountHolderVerificationWebhookEvent::Status, Models::AccountUpdateParams::State, Models::AccountUpdateParams::Substatus, Models::AggregateBalance::FinancialAccountType, Models::AggregateBalanceListParams::FinancialAccountType, Models::AsaRequestWebhookEvent::AccountType, Models::AsaRequestWebhookEvent::Avs::AddressOnFileMatch, Models::AsaRequestWebhookEvent::Card::SpendLimitDuration, Models::AsaRequestWebhookEvent::Card::State, Models::AsaRequestWebhookEvent::Card::Type, Models::AsaRequestWebhookEvent::FleetInfo::FleetPromptCode, Models::AsaRequestWebhookEvent::FleetInfo::FleetRestrictionCode, Models::AsaRequestWebhookEvent::LatestChallenge::Status, Models::AsaRequestWebhookEvent::Network, Models::AsaRequestWebhookEvent::Pos::EntryMode::Card, Models::AsaRequestWebhookEvent::Pos::EntryMode::Cardholder, Models::AsaRequestWebhookEvent::Pos::EntryMode::Pan, Models::AsaRequestWebhookEvent::Pos::Terminal::Operator, Models::AsaRequestWebhookEvent::Pos::Terminal::PinCapability, Models::AsaRequestWebhookEvent::Pos::Terminal::Type, Models::AsaRequestWebhookEvent::Status, Models::AsaRequestWebhookEvent::TransactionInitiator, Models::AuthRules::AuthRule::State, Models::AuthRules::AuthRule::Type, Models::AuthRules::Conditional3DSActionParameters::Action, Models::AuthRules::Conditional3DSActionParameters::Condition::Attribute, Models::AuthRules::ConditionalACHActionParameters::Action::ApproveAction::Type, Models::AuthRules::ConditionalACHActionParameters::Action::ReturnAction::Code, Models::AuthRules::ConditionalACHActionParameters::Action::ReturnAction::Type, Models::AuthRules::ConditionalACHActionParameters::Condition::Attribute, Models::AuthRules::ConditionalAttribute, Models::AuthRules::ConditionalAuthorizationActionParameters::Action, Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Attribute, Models::AuthRules::ConditionalOperation, Models::AuthRules::ConditionalTokenizationActionParameters::Action::DeclineAction::Reason, Models::AuthRules::ConditionalTokenizationActionParameters::Action::DeclineAction::Type, Models::AuthRules::ConditionalTokenizationActionParameters::Action::RequireTfaAction::Reason, Models::AuthRules::ConditionalTokenizationActionParameters::Action::RequireTfaAction::Type, Models::AuthRules::ConditionalTokenizationActionParameters::Condition::Attribute, Models::AuthRules::EventStream, Models::AuthRules::RuleStats::Example::Decision, Models::AuthRules::V2CreateParams::Type, Models::AuthRules::V2ListParams::Scope, Models::AuthRules::V2RetrieveFeaturesResponse::Feature::Filters::IncludePanEntryMode, Models::AuthRules::V2RetrieveFeaturesResponse::Feature::Scope, Models::AuthRules::V2UpdateParams::State, Models::AuthRules::VelocityLimitParams::Filters::IncludePanEntryMode, Models::AuthRules::VelocityLimitParams::Scope, Models::Balance::FinancialAccountType, Models::BalanceListParams::FinancialAccountType, Models::BookTransferCreateParams::Category, Models::BookTransferCreateParams::OnClosedAccount, Models::BookTransferCreateParams::Type, Models::BookTransferListParams::Category, Models::BookTransferListParams::Result, Models::BookTransferListParams::Status, Models::BookTransferResponse::Category, Models::BookTransferResponse::Event::DetailedResult, Models::BookTransferResponse::Event::Result, Models::BookTransferResponse::Event::Type, Models::BookTransferResponse::Result, Models::BookTransferResponse::Status, Models::CardBulkOrder::ShippingMethod, Models::CardBulkOrder::Status, Models::CardBulkOrderCreateParams::ShippingMethod, Models::CardBulkOrderUpdateParams::Status, Models::CardConvertPhysicalParams::ShippingMethod, Models::CardCreateParams::ReplacementSubstatus, Models::CardCreateParams::ShippingMethod, Models::CardCreateParams::State, Models::CardCreateParams::Type, Models::CardListParams::State, Models::CardProvisionParams::DigitalWallet, Models::CardReissueParams::ShippingMethod, Models::CardRenewParams::ShippingMethod, Models::CardShippedWebhookEvent::ShippingMethod, Models::CardUpdateParams::PinStatus, Models::CardUpdateParams::State, Models::CardUpdateParams::Substatus, Models::CardWebProvisionParams::DigitalWallet, Models::CardholderAuthentication::AuthenticationMethod, Models::CardholderAuthentication::AuthenticationResult, Models::CardholderAuthentication::DecisionMadeBy, Models::CardholderAuthentication::LiabilityShift, Models::Cards::FinancialTransactionListParams::Category, Models::Cards::FinancialTransactionListParams::Result, Models::Cards::FinancialTransactionListParams::Status, Models::DigitalCardArtAPI::Network, Models::DigitalWalletTokenMetadata::TokenRequestorName, Models::DigitalWalletTokenizationApprovalRequestWebhookEvent::CustomerTokenizationDecision::Outcome, Models::DigitalWalletTokenizationApprovalRequestWebhookEvent::EventType, Models::DigitalWalletTokenizationApprovalRequestWebhookEvent::IssuerDecision, Models::DigitalWalletTokenizationApprovalRequestWebhookEvent::TokenizationChannel, Models::DigitalWalletTokenizationApprovalRequestWebhookEvent::TokenizationSource, Models::DigitalWalletTokenizationResultWebhookEvent::TokenizationResultDetails::TokenizationDeclineReason, Models::DigitalWalletTokenizationTwoFactorAuthenticationCodeSentWebhookEvent::ActivationMethod::Type, Models::DigitalWalletTokenizationTwoFactorAuthenticationCodeWebhookEvent::ActivationMethod::Type, Models::Dispute::Reason, Models::Dispute::ResolutionReason, Models::Dispute::Status, Models::DisputeCreateParams::Reason, Models::DisputeEvidence::UploadStatus, Models::DisputeListParams::Status, Models::DisputeUpdateParams::Reason, Models::DisputeV2::Disposition, Models::DisputeV2::Event::Data::CardholderLiability::Action, Models::DisputeV2::Event::Data::Financial::Polarity, Models::DisputeV2::Event::Data::Financial::Stage, Models::DisputeV2::Event::Data::Workflow::Action, Models::DisputeV2::Event::Data::Workflow::Disposition, Models::DisputeV2::Event::Data::Workflow::Stage, Models::DisputeV2::Event::Type, Models::DisputeV2::Network, Models::DisputeV2::Status, Models::DisputeV2::TransactionSeries::Type, Models::Document::DocumentType, Models::Document::RequiredDocumentUpload::ImageType, Models::Document::RequiredDocumentUpload::Status, Models::Document::RequiredDocumentUpload::StatusReason, Models::Event::EventType, Models::EventListAttemptsParams::Status, Models::EventListParams::EventType, Models::EventSubscription::EventType, Models::Events::SubscriptionCreateParams::EventType, Models::Events::SubscriptionListAttemptsParams::Status, Models::Events::SubscriptionSendSimulatedExampleParams::EventType, Models::Events::SubscriptionUpdateParams::EventType, Models::ExternalBankAccount::State, Models::ExternalBankAccount::Type, Models::ExternalBankAccount::VerificationState, Models::ExternalBankAccountCreateParams::Type, Models::ExternalBankAccountCreateParams::VerificationMethod, Models::ExternalBankAccountCreateResponse::OwnerType, Models::ExternalBankAccountCreateResponse::State, Models::ExternalBankAccountCreateResponse::Type, Models::ExternalBankAccountCreateResponse::VerificationMethod, Models::ExternalBankAccountCreateResponse::VerificationState, Models::ExternalBankAccountListParams::AccountType, Models::ExternalBankAccountListParams::State, Models::ExternalBankAccountListParams::VerificationState, Models::ExternalBankAccountListResponse::OwnerType, Models::ExternalBankAccountListResponse::State, Models::ExternalBankAccountListResponse::Type, Models::ExternalBankAccountListResponse::VerificationMethod, Models::ExternalBankAccountListResponse::VerificationState, Models::ExternalBankAccountRetrieveResponse::OwnerType, Models::ExternalBankAccountRetrieveResponse::State, Models::ExternalBankAccountRetrieveResponse::Type, Models::ExternalBankAccountRetrieveResponse::VerificationMethod, Models::ExternalBankAccountRetrieveResponse::VerificationState, Models::ExternalBankAccountRetryMicroDepositsResponse::OwnerType, Models::ExternalBankAccountRetryMicroDepositsResponse::State, Models::ExternalBankAccountRetryMicroDepositsResponse::Type, Models::ExternalBankAccountRetryMicroDepositsResponse::VerificationMethod, Models::ExternalBankAccountRetryMicroDepositsResponse::VerificationState, Models::ExternalBankAccountUpdateParams::Type, Models::ExternalBankAccountUpdateResponse::OwnerType, Models::ExternalBankAccountUpdateResponse::State, Models::ExternalBankAccountUpdateResponse::Type, Models::ExternalBankAccountUpdateResponse::VerificationMethod, Models::ExternalBankAccountUpdateResponse::VerificationState, Models::ExternalBankAccounts::MicroDepositCreateResponse::OwnerType, Models::ExternalBankAccounts::MicroDepositCreateResponse::State, Models::ExternalBankAccounts::MicroDepositCreateResponse::Type, Models::ExternalBankAccounts::MicroDepositCreateResponse::VerificationMethod, Models::ExternalBankAccounts::MicroDepositCreateResponse::VerificationState, Models::ExternalPayment::Category, Models::ExternalPayment::Event::DetailedResult, Models::ExternalPayment::Event::Result, Models::ExternalPayment::Event::Type, Models::ExternalPayment::Family, Models::ExternalPayment::PaymentType, Models::ExternalPayment::Result, Models::ExternalPayment::Status, Models::ExternalPaymentCreateParams::Category, Models::ExternalPaymentCreateParams::PaymentType, Models::ExternalPaymentCreateParams::ProgressTo, Models::ExternalPaymentListParams::Category, Models::ExternalPaymentListParams::Result, Models::ExternalPaymentListParams::Status, Models::ExternalPaymentSettleParams::ProgressTo, Models::ExternalResourceType, Models::FinancialAccount::Status, Models::FinancialAccount::Substatus, Models::FinancialAccount::Type, Models::FinancialAccountBalance::Type, Models::FinancialAccountCreateParams::Type, Models::FinancialAccountListParams::Type, Models::FinancialAccountUpdateStatusParams::Status, Models::FinancialAccountUpdateStatusParams::Substatus, Models::FinancialAccounts::FinancialTransactionListParams::Category, Models::FinancialAccounts::FinancialTransactionListParams::Result, Models::FinancialAccounts::FinancialTransactionListParams::Status, Models::FinancialAccounts::LoanTape::AccountStanding::FinancialAccountState::Status, Models::FinancialAccounts::LoanTape::AccountStanding::FinancialAccountState::Substatus, Models::FinancialAccounts::LoanTape::AccountStanding::PeriodState, Models::FinancialAccounts::LoanTape::InterestDetails::InterestCalculationMethod, Models::FinancialAccounts::Statement::AccountStanding::FinancialAccountState::Status, Models::FinancialAccounts::Statement::AccountStanding::FinancialAccountState::Substatus, Models::FinancialAccounts::Statement::AccountStanding::PeriodState, Models::FinancialAccounts::Statement::InterestDetails::InterestCalculationMethod, Models::FinancialAccounts::Statement::StatementType, Models::FinancialAccounts::Statements::StatementLineItems::Data::Category, Models::FinancialAccounts::Statements::StatementLineItems::Data::EventType, Models::FinancialEvent::Result, Models::FinancialEvent::Type, Models::FinancialTransaction::Category, Models::FinancialTransaction::Result, Models::FinancialTransaction::Status, Models::Fraud::TransactionReportParams::FraudStatus, Models::Fraud::TransactionReportParams::FraudType, Models::Fraud::TransactionReportResponse::FraudStatus, Models::Fraud::TransactionReportResponse::FraudType, Models::Fraud::TransactionRetrieveResponse::FraudStatus, Models::Fraud::TransactionRetrieveResponse::FraudType, Models::FundingEvent::CollectionResourceType, Models::InstanceFinancialAccountType, Models::InternalTransactionAPI::Category, Models::InternalTransactionAPI::Event::Result, Models::InternalTransactionAPI::Event::Type, Models::InternalTransactionAPI::Result, Models::InternalTransactionAPI::Status, Models::KYB::Workflow, Models::KYC::Workflow, Models::KYCExempt::KYCExemptionType, Models::KYCExempt::Workflow, Models::ManagementOperationCreateParams::Category, Models::ManagementOperationCreateParams::Direction, Models::ManagementOperationCreateParams::EventType, Models::ManagementOperationCreateParams::OnClosedAccount, Models::ManagementOperationListParams::Category, Models::ManagementOperationListParams::Status, Models::ManagementOperationTransaction::Category, Models::ManagementOperationTransaction::Direction, Models::ManagementOperationTransaction::Event::DetailedResult, Models::ManagementOperationTransaction::Event::Result, Models::ManagementOperationTransaction::Event::Type, Models::ManagementOperationTransaction::Family, Models::ManagementOperationTransaction::Result, Models::ManagementOperationTransaction::Status, Models::MessageAttempt::Status, Models::NetworkTotal::Network, Models::NonPCICard::Funding::State, Models::NonPCICard::Funding::Type, Models::NonPCICard::PinStatus, Models::NonPCICard::State, Models::NonPCICard::Substatus, Models::NonPCICard::Type, Models::OwnerType, Models::ParsedWebhookEvent::KYBPayload::EventType, Models::ParsedWebhookEvent::KYCPayload::EventType, Models::ParsedWebhookEvent::LegacyPayload::EventType, Models::Payment::Category, Models::Payment::Direction, Models::Payment::Event::DetailedResult, Models::Payment::Event::Result, Models::Payment::Event::Type, Models::Payment::Method, Models::Payment::MethodAttributes::ACHMethodAttributes::SecCode, Models::Payment::MethodAttributes::WireMethodAttributes::WireNetwork, Models::Payment::Result, Models::Payment::Source, Models::Payment::Status, Models::Payment::Type, Models::PaymentCreateParams::Method, Models::PaymentCreateParams::MethodAttributes::SecCode, Models::PaymentCreateParams::Type, Models::PaymentListParams::Category, Models::PaymentListParams::Result, Models::PaymentListParams::Status, Models::PaymentSimulateActionParams::DeclineReason, Models::PaymentSimulateActionParams::EventType, Models::PaymentSimulateActionResponse::Result, Models::PaymentSimulateReceiptParams::ReceiptType, Models::PaymentSimulateReceiptResponse::Result, Models::PaymentSimulateReleaseResponse::Result, Models::PaymentSimulateReturnResponse::Result, Models::Reports::Settlement::NetworkTotalListParams::Network, Models::ResponderEndpointCheckStatusParams::Type, Models::ResponderEndpointCreateParams::Type, Models::ResponderEndpointDeleteParams::Type, Models::SettlementDetail::Network, Models::SettlementDetail::Type, Models::SettlementSummaryDetails::Network, Models::SpendLimitDuration, Models::ThreeDS::AuthenticationSimulateParams::CardExpiryCheck, Models::ThreeDS::ChallengeResult, Models::ThreeDSAuthentication::AccountType, Models::ThreeDSAuthentication::AdditionalData::NetworkDecision, Models::ThreeDSAuthentication::AuthenticationRequestType, Models::ThreeDSAuthentication::AuthenticationResult, Models::ThreeDSAuthentication::CardExpiryCheck, Models::ThreeDSAuthentication::Cardholder::AddressOnFileMatch, Models::ThreeDSAuthentication::ChallengeMetadata::MethodType, Models::ThreeDSAuthentication::ChallengeMetadata::Status, Models::ThreeDSAuthentication::ChallengeOrchestratedBy, Models::ThreeDSAuthentication::Channel, Models::ThreeDSAuthentication::DecisionMadeBy, Models::ThreeDSAuthentication::Merchant::RiskIndicator::DeliveryTimeFrame, Models::ThreeDSAuthentication::Merchant::RiskIndicator::OrderAvailability, Models::ThreeDSAuthentication::Merchant::RiskIndicator::ReorderItems, Models::ThreeDSAuthentication::Merchant::RiskIndicator::ShippingMethod, Models::ThreeDSAuthentication::MessageCategory, Models::ThreeDSAuthentication::ThreeDSRequestorChallengeIndicator, Models::ThreeDSAuthentication::ThreeRiRequestType, Models::ThreeDSAuthentication::Transaction::Type, Models::ThreeDSAuthenticationChallengeWebhookEvent::Challenge::ChallengeMethodType, Models::TokenInfo::WalletType, Models::Tokenization::Event::Result, Models::Tokenization::Event::Type, Models::Tokenization::Status, Models::Tokenization::TokenizationChannel, Models::TokenizationApprovalRequestWebhookEvent::CustomerTokenizationDecision::Outcome, Models::TokenizationApprovalRequestWebhookEvent::EventType, Models::TokenizationApprovalRequestWebhookEvent::IssuerDecision, Models::TokenizationApprovalRequestWebhookEvent::TokenizationChannel, Models::TokenizationApprovalRequestWebhookEvent::TokenizationSource, Models::TokenizationDecisioningRequestWebhookEvent::EventType, Models::TokenizationDecisioningRequestWebhookEvent::IssuerDecision, Models::TokenizationDecisioningRequestWebhookEvent::TokenizationChannel, Models::TokenizationDecisioningRequestWebhookEvent::TokenizationSource, Models::TokenizationDeclineReason, Models::TokenizationListParams::TokenizationChannel, Models::TokenizationResendActivationCodeParams::ActivationMethodType, Models::TokenizationResultWebhookEvent::TokenizationResultDetails::TokenizationDeclineReason, Models::TokenizationRuleResult::Result, Models::TokenizationSimulateParams::TokenizationSource, Models::TokenizationSimulateParams::WalletRecommendedDecision, Models::TokenizationTfaReason, Models::TokenizationTwoFactorAuthenticationCodeSentWebhookEvent::ActivationMethod::Type, Models::TokenizationTwoFactorAuthenticationCodeWebhookEvent::ActivationMethod::Type, Models::Transaction::Event::AccountType, Models::Transaction::Event::DetailedResult, Models::Transaction::Event::EffectivePolarity, Models::Transaction::Event::Result, Models::Transaction::Event::RuleResult::Result, Models::Transaction::Event::Type, Models::Transaction::Network, Models::Transaction::Pos::EntryMode::Card, Models::Transaction::Pos::EntryMode::Cardholder, Models::Transaction::Pos::EntryMode::Pan, Models::Transaction::Pos::Terminal::Operator, Models::Transaction::Pos::Terminal::PinCapability, Models::Transaction::Pos::Terminal::Type, Models::Transaction::Result, Models::Transaction::Status, Models::TransactionListParams::Result, Models::TransactionListParams::Status, Models::TransactionSimulateAuthorizationParams::Status, Models::TransactionSimulateVoidParams::Type, Models::Transactions::Events::EnhancedData::Common::Tax::Exempt, Models::Transactions::Events::EnhancedData::Fleet::Fuel::Type, Models::Transactions::Events::EnhancedData::Fleet::Fuel::UnitOfMeasure, Models::Transactions::Events::EnhancedData::Fleet::ServiceType, Models::Transfer::Category, Models::Transfer::Result, Models::Transfer::Status, Models::VerificationMethod
Defined in:
lib/lithic/internal/type/enum.rb

Overview

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.

A value from among a specified list of options. OpenAPI enum values map to Ruby values in the SDK as follows:

  1. boolean => true | false

  2. integer => Integer

  3. float => Float

  4. string => Symbol

We can therefore convert string values to Symbols, but can’t convert other values safely.

Examples:

# `account_financial_account_type` is a `Lithic::AccountFinancialAccountType`
case 
when Lithic::AccountFinancialAccountType::ISSUING
  # ...
when Lithic::AccountFinancialAccountType::OPERATING
  # ...
else
  puts()
end
case 
in :ISSUING
  # ...
in :OPERATING
  # ...
else
  puts()
end

Instance Method Summary collapse

Methods included from Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, to_sorbet_type

Methods included from Converter

coerce, dump, inspect, meta_info, new_coerce_state, type_info

Instance Method Details

#==(other) ⇒ Boolean

Parameters:

  • other (Object)

Returns:



60
61
62
63
64
# File 'lib/lithic/internal/type/enum.rb', line 60

def ==(other)
  # rubocop:disable Style/CaseEquality
  Lithic::Internal::Type::Enum === other && other.values.to_set == values.to_set
  # rubocop:enable Style/CaseEquality
end

#===(other) ⇒ Boolean

Parameters:

  • other (Object)

Returns:



53
# File 'lib/lithic/internal/type/enum.rb', line 53

def ===(other) = values.include?(other)

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

Unlike with primitives, ‘Enum` additionally validates that the value is a member of the enum.

Parameters:

  • value (String, Symbol, 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:

  • (Symbol, Object)


91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/lithic/internal/type/enum.rb', line 91

def coerce(value, state:)
  exactness = state.fetch(:exactness)
  val = value.is_a?(String) ? value.to_sym : value

  if values.include?(val)
    exactness[:yes] += 1
    val
  elsif values.first&.class == val.class
    exactness[:maybe] += 1
    value
  else
    exactness[:no] += 1
    state[:error] = TypeError.new("#{value.class} can't be coerced into #{self}")
    value
  end
end

#dump(value, state:) ⇒ Symbol, 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 (Symbol, Object)
  • state (Hash{Symbol=>Object})

    .

    @option state [Boolean] :can_retry

Returns:

  • (Symbol, Object)


# File 'lib/lithic/internal/type/enum.rb', line 108


#hashInteger

Returns:

  • (Integer)


69
# File 'lib/lithic/internal/type/enum.rb', line 69

def hash = values.to_set.hash

#inspect(depth: 0) ⇒ String

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:

  • depth (Integer) (defaults to: 0)

Returns:

  • (String)


139
140
141
142
143
144
145
146
147
148
# File 'lib/lithic/internal/type/enum.rb', line 139

def inspect(depth: 0)
  if depth.positive?
    return is_a?(Module) ? super() : self.class.name
  end

  members = values.map { Lithic::Internal::Type::Converter.inspect(_1, depth: depth.succ) }
  prefix = is_a?(Module) ? name : self.class.name

  "#{prefix}[#{members.join(' | ')}]"
end

#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)


122
123
124
125
126
127
128
129
130
131
132
# File 'lib/lithic/internal/type/enum.rb', line 122

def to_sorbet_type
  types = values.map { Lithic::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq
  case types
  in []
    T.noreturn
  in [type]
    type
  else
    T.any(*types)
  end
end

#valuesArray<NilClass, Boolean, Integer, Float, Symbol>

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.

All of the valid Symbol values for this enum.

Returns:

  • (Array<NilClass, Boolean, Integer, Float, Symbol>)


46
# File 'lib/lithic/internal/type/enum.rb', line 46

def values = constants.map { const_get(_1) }