Class: Mayak::Json::Encoder::FromFunction
- Inherits:
-
Object
- Object
- Mayak::Json::Encoder::FromFunction
- Extended by:
- T::Generic, T::Helpers, T::Sig
- Includes:
- Encoder
- Defined in:
- lib/mayak/json/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.
31 32 33 |
# File 'lib/mayak/json/encoder.rb', line 31 def initialize(&function) @function = T.let(function, T.proc.params(response: ResponseEntity).returns(ResponseType)) end |
Instance Method Details
#encode(entity) ⇒ Object
36 37 38 |
# File 'lib/mayak/json/encoder.rb', line 36 def encode(entity) @function.call(entity) end |