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