Class: Pathway::Result::Success
Instance Attribute Summary
#error, #value
Instance Method Summary
collapse
failure, #failure?, result, success
Constructor Details
#initialize(value) ⇒ Success
Returns a new instance of Success.
7
8
9
|
# File 'lib/pathway/result.rb', line 7
def initialize(value)
@value = value
end
|
Instance Method Details
#success? ⇒ Boolean
11
12
13
|
# File 'lib/pathway/result.rb', line 11
def success?
true
end
|
#tee(bl = nil, &block) ⇒ Object
19
20
21
22
|
# File 'lib/pathway/result.rb', line 19
def tee(bl=nil, &block)
follow = self.then(bl, &block)
follow.failure? ? follow : self
end
|
#then(bl = nil) ⇒ Object
15
16
17
|
# File 'lib/pathway/result.rb', line 15
def then(bl=nil)
result(block_given? ? yield(value): bl.call(value))
end
|