Sha256: 4d4c5f142118ca2ee334ec8539c103bf50de0d77dc25506816b06b4612516670

Contents?: true

Size: 1.03 KB

Versions: 89

Compression:

Stored size: 1.03 KB

Contents

# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.

# typed: true
# frozen_string_literal: true

module T
  def self.arr?(t)
    if t.respond_to? :underlying_class
      return t.underlying_class == ::Array
    end
    false
  end

  def self.arr_of(t)
    get_raw_type(t.type)
  end

  def self.hash?(t)
    if t.respond_to? :underlying_class
      return t.underlying_class == ::Hash
    end
    false
  end

  def self.hash_of(t)
    get_raw_type(t.values)
  end

  def self.nilable?(t)
    t.respond_to? :unwrap_nilable
  end

  def self.nilable_of(t)
    if t.respond_to? :unwrap_nilable
      return simplify_type t.unwrap_nilable
    end
    nil
  end

  def self.simplifiable?(t)
    return t.is_a? T::Types::Simple
  end

  def self.simplify_type(t)
    if t.is_a? T::Types::Simple
      return t.raw_type
    end
    t
  end

  def self.get_raw_type(t)
    if t.respond_to? :raw_type
      return t.raw_type
    elsif t.respond_to? :raw_a
      return T::Boolean if t.raw_a in [TrueClass, FalseClass]
    end
    t
  end
end

Version data entries

89 entries across 89 versions & 5 rubygems

Version Path
dub-0.0.2 lib/open_api_sdk/utils/t.rb
speakeasy_client_sdk_ruby-4.1.11 lib/speakeasy_client_sdk/utils/t.rb
stackone_client-0.2.18 lib/stack_one/utils/t.rb
speakeasy_client_sdk_ruby-4.1.10 lib/speakeasy_client_sdk/utils/t.rb
stackone_client-0.2.17 lib/stack_one/utils/t.rb
speakeasy_client_sdk_ruby-4.1.9 lib/speakeasy_client_sdk/utils/t.rb
stackone_client-0.2.16 lib/stack_one/utils/t.rb
ding_sdk-0.8.7 lib/ding_sdk/utils/t.rb
speakeasy_client_sdk_ruby-4.1.8 lib/speakeasy_client_sdk/utils/t.rb
stackone_client-0.2.15 lib/stack_one/utils/t.rb
stackone_client-0.2.14 lib/stack_one/utils/t.rb
speakeasy_client_sdk_ruby-4.1.7 lib/speakeasy_client_sdk/utils/t.rb
speakeasy_client_sdk_ruby-4.1.6 lib/speakeasy_client_sdk/utils/t.rb
speakeasy_client_sdk_ruby-4.1.5 lib/speakeasy_client_sdk/utils/t.rb
speakeasy_client_sdk_ruby-4.1.4 lib/speakeasy_client_sdk/utils/t.rb
stackone_client-0.2.13 lib/stack_one/utils/t.rb
stackone_client-0.2.12 lib/stack_one/utils/t.rb
speakeasy_client_sdk_ruby-4.1.3 lib/speakeasy_client_sdk/utils/t.rb
speakeasy_client_sdk_ruby-4.1.2 lib/speakeasy_client_sdk/utils/t.rb
speakeasy_client_sdk_ruby-4.1.1 lib/speakeasy_client_sdk/utils/t.rb