Class: Mayak::Encoder::FromFunction
- Inherits:
-
Object
- Object
- Mayak::Encoder::FromFunction
- Extended by:
- T::Generic, T::Helpers, T::Sig
- Includes:
- Mayak::Encoder
- Defined in:
- lib/mayak/encoder.rb
Constant Summary collapse
- ResponseEntity =
type_member
- ResponseType =
type_member
Instance Method Summary collapse
- #encode(entity) ⇒ Object
-
#initialize(&function) ⇒ FromFunction
constructor
A new instance of FromFunction.
Methods included from Mayak::Encoder
Constructor Details
#initialize(&function) ⇒ FromFunction
Returns a new instance of FromFunction.
41 42 43 |
# File 'lib/mayak/encoder.rb', line 41 def initialize(&function) @function = T.let(function, T.proc.params(response: ResponseEntity).returns(ResponseType)) end |
Instance Method Details
#encode(entity) ⇒ Object
46 47 48 |
# File 'lib/mayak/encoder.rb', line 46 def encode(entity) @function.call(entity) end |