Class: Zx::Steps
Constant Summary
Maybe::ClassMethods::Maybe, Maybe::ClassMethods::None, Maybe::ClassMethods::Some
Class Method Summary
collapse
Instance Method Summary
collapse
#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
|
.steps ⇒ Object
12
13
14
|
# File 'lib/zx/steps.rb', line 12
def steps
@steps ||= []
end
|
Instance Method Details
#call ⇒ Object
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
|