Class: Mayak::Function
- Inherits:
-
Object
- Object
- Mayak::Function
- Extended by:
- T::Generic, T::Helpers, T::Sig
- Defined in:
- lib/mayak/function.rb
Constant Summary collapse
- Input =
type_member
- Output =
type_member
Instance Attribute Summary collapse
-
#blk ⇒ Object
readonly
Returns the value of attribute blk.
Class Method Summary collapse
Instance Method Summary collapse
- #and_then(another) ⇒ Object (also: #>>)
- #call(input) ⇒ Object
- #compose(another) ⇒ Object (also: #<<)
-
#initialize(&blk) ⇒ Function
constructor
A new instance of Function.
Constructor Details
Instance Attribute Details
#blk ⇒ Object (readonly)
Returns the value of attribute blk.
14 15 16 |
# File 'lib/mayak/function.rb', line 14 def blk @blk end |
Class Method Details
Instance Method Details
#and_then(another) ⇒ Object Also known as: >>
45 46 47 |
# File 'lib/mayak/function.rb', line 45 def and_then(another) Mayak::Function[Input, T.type_parameter(:Output2)].new { |a| another.call(blk.call(a)) } end |
#call(input) ⇒ Object
36 37 38 |
# File 'lib/mayak/function.rb', line 36 def call(input) blk.call(input) end |