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.



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

def initialize(value) = @value = value

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


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

def success? = true

#teeObject



16
17
18
19
# File 'lib/pathway/result.rb', line 16

def tee(...)
  follow = self.then(...)
  follow.failure? ? follow : self
end

#then(bl = nil) ⇒ Object



12
13
14
# File 'lib/pathway/result.rb', line 12

def then(bl=nil)
  result(block_given? ? yield(value): bl.call(value))
end