Module: Fear::For Private

Defined in:
lib/fear/for.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

See Also:

  • for

Defined Under Namespace

Modules: Mixin

Class Method Summary collapse

Class Method Details

.call(monads, inner_values = [], &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:



11
12
13
14
15
16
17
18
19
# File 'lib/fear/for.rb', line 11

def call(monads, inner_values = [], &block)
  head, *tail = *monads

  if tail.length.zero?
    map(head, inner_values, &block)
  else
    flat_map(head, tail, inner_values, &block)
  end
end