Class: Mayak::Encoder::Implementation

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

Constant Summary collapse

In =
type_member
Out =
type_member

Instance Method Summary collapse

Methods included from Mayak::Encoder

#map

Constructor Details

#initialize(&function) ⇒ Implementation

Returns a new instance of Implementation.



40
41
42
# File 'lib/mayak/encoder.rb', line 40

def initialize(&function)
  @function = T.let(function, T.proc.params(in: In).returns(Out))
end

Instance Method Details

#encode(entity) ⇒ Object



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

def encode(entity)
  @function.call(entity)
end