Class: Pathway::Result::Success

Inherits:
Pathway::Result show all
Defined in:
lib/pathway/result.rb

Instance Attribute Summary

Attributes inherited from Pathway::Result

#error, #value

Instance Method Summary collapse

Methods inherited from Pathway::Result

#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

Returns:

  • (Boolean)


11
# File 'lib/pathway/result.rb', line 11

def success? = true

#teeObject



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