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