Class: Alchemrest::Transforms::Union

Inherits:
Morpher::Transform
  • Object
show all
Defined in:
lib/alchemrest/transforms/union.rb

Instance Method Summary collapse

Instance Method Details

#call(input) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/alchemrest/transforms/union.rb', line 10

def call(input)
  type_key = input&.fetch(discriminator.to_s)
  if type_key.nil?
    klass_not_found_failure_error(input)
  else
    perform_transformation(input, type_key)
  end
end

#output_typeObject



19
20
21
# File 'lib/alchemrest/transforms/union.rb', line 19

def output_type
  OutputType.simple(T.any(*types.values))
end