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.
9
10
11
|
# File 'lib/pathway/result.rb', line 9
def initialize(value)
@value = value
end
|
Instance Method Details
#success? ⇒ Boolean
13
14
15
|
# File 'lib/pathway/result.rb', line 13
def success?
true
end
|
#tee(bl = nil, &block) ⇒ Object
21
22
23
24
|
# File 'lib/pathway/result.rb', line 21
def tee(bl=nil, &block)
follow = self.then(bl, &block)
follow.failure? ? follow : self
end
|
#then(bl = nil) ⇒ Object
17
18
19
|
# File 'lib/pathway/result.rb', line 17
def then(bl=nil)
result(block_given? ? yield(value): bl.call(value))
end
|