Class: Zx::Steps

Inherits:
Object
  • Object
show all
Includes:
Maybeable
Defined in:
lib/zx/steps.rb

Constant Summary

Constants included from Maybe::ClassMethods

Maybe::ClassMethods::Maybe, Maybe::ClassMethods::None, Maybe::ClassMethods::Some

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Maybe::ClassMethods

#Maybe, #None, #Some, #Try

Class Method Details

.step(step) ⇒ Object



8
9
10
# File 'lib/zx/steps.rb', line 8

def step(step)
  steps << step
end

.stepsObject



12
13
14
# File 'lib/zx/steps.rb', line 12

def steps
  @steps ||= []
end

Instance Method Details

#callObject



17
18
19
20
# File 'lib/zx/steps.rb', line 17

def call
  list = self.class.steps
  list.reduce(Some()) { |result, step| result >> send(step) }
end