Class: Mayak::Decoder::Implementation

Inherits:
Object
  • Object
show all
Extended by:
T::Generic, T::Helpers, T::Sig
Includes:
Mayak::Decoder
Defined in:
lib/mayak/decoder.rb

Constant Summary collapse

In =
type_member
Out =
type_member

Instance Method Summary collapse

Methods included from Mayak::Decoder

#map

Constructor Details

#initialize(&function) ⇒ Implementation



45
46
47
# File 'lib/mayak/decoder.rb', line 45

def initialize(&function)
  @function = T.let(function, T.proc.params(response: In).returns(::Mayak::Monads::Try[Out]))
end

Instance Method Details

#decode(response) ⇒ Object



54
55
56
# File 'lib/mayak/decoder.rb', line 54

def decode(response)
  @function.call(response)
end