Module: Zx::Fmap

Defined in:
lib/zx/fmap.rb

Class Method Summary collapse

Class Method Details

.call(result, &block) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/zx/fmap.rb', line 5

def self.call(result, &block)
  return result if result.failure?

  new_value = block.call result.value
  result.instance_variable_set(:@value, new_value)

  result
end