Class: Decoding::Ok
Overview
The Ok value represents the result of a successful computation.
Instance Attribute Summary
Attributes inherited from Result
#hash
Instance Method Summary
collapse
Methods inherited from Result
all, #deconstruct, #eql?, err, #err?, #initialize, #inspect, #map_err, ok, #to_result, #unwrap_err
Instance Method Details
#and(other) ⇒ Object
147
148
149
150
151
|
# File 'lib/decoding/result.rb', line 147
def and(other)
return other unless other.is_a?(self.class)
self.class.new(yield value, other.value)
end
|
#and_then ⇒ Object
153
|
# File 'lib/decoding/result.rb', line 153
def and_then = yield(value).to_result
|
#map ⇒ Object
145
|
# File 'lib/decoding/result.rb', line 145
def map = self.class.new(yield value)
|
#ok? ⇒ Boolean
143
|
# File 'lib/decoding/result.rb', line 143
def ok? = true
|
#unwrap(_) ⇒ Object
144
|
# File 'lib/decoding/result.rb', line 144
def unwrap(_) = value
|