Class: Keiyaku::OneOf

Inherits:
Object
  • Object
show all
Defined in:
lib/keiyaku/runtime.rb,
sig/keiyaku.rbs

Overview

A union with a discriminator: into: OneOf[Dog, Cat, on: "petType"]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(variants, discriminator, map) ⇒ OneOf

Returns a new instance of OneOf.

Parameters:

  • (Array[untyped])
  • (String)
  • (Hash[untyped, untyped])


107
# File 'sig/keiyaku.rbs', line 107

def initialize: (Array[untyped], String, Hash[untyped, untyped]) -> void

Class Method Details

.[](*variants, on:, map: {}) ⇒ OneOf

Parameters:

  • variants (Object)
  • on: (String)
  • map: (Hash[untyped, untyped]) (defaults to: {})

Returns:



106
# File 'sig/keiyaku.rbs', line 106

def self.[]: (*untyped variants, on: String, ?map: Hash[untyped, untyped]) -> OneOf

Instance Method Details

#cast(value, path = "value") ⇒ Object

Parameters:

  • (Object)
  • (String)

Returns:

  • (Object)

Raises:



108
# File 'sig/keiyaku.rbs', line 108

def cast: (untyped, ?String) -> untyped