Class: Alchemrest::Transforms::Typed
- Inherits:
-
Morpher::Transform
- Object
- Morpher::Transform
- Alchemrest::Transforms::Typed
- Includes:
- Adamantium::Mutable
- Defined in:
- lib/alchemrest/transforms/typed.rb
Overview
A wrapper around other transforms that provides metadata about the return type of the transform. Note this does not do anything to actually enforce that return type, although we may want to change that in the future. It’s main purpose is to provide metadata we can use to inspect the schema of an ‘Alchemrest::Data` class.
Instance Method Summary collapse
Instance Method Details
#array ⇒ Object
17 18 19 20 21 22 |
# File 'lib/alchemrest/transforms/typed.rb', line 17 def array Typed.new( transform: super(), output_type: output_type.with(sorbet_type: T::Array[output_type.sorbet_type]), ) end |
#call(input) ⇒ Object
13 14 15 |
# File 'lib/alchemrest/transforms/typed.rb', line 13 def call(input) transform.call(input) end |
#maybe ⇒ Object
24 25 26 27 28 29 |
# File 'lib/alchemrest/transforms/typed.rb', line 24 def maybe Typed.new( transform: super(), output_type: output_type.with(sorbet_type: T.nilable(output_type.sorbet_type)), ) end |