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
159
160
161
162
163
|
# File 'lib/decoding/result.rb', line 159
def and(other)
return other unless other.is_a?(self.class)
self.class.new(yield value, other.value)
end
|
#and_then ⇒ Object
165
|
# File 'lib/decoding/result.rb', line 165
def and_then = yield(value).to_result
|
#map ⇒ Object
157
|
# File 'lib/decoding/result.rb', line 157
def map = self.class.new(yield value)
|
#ok? ⇒ Boolean
154
|
# File 'lib/decoding/result.rb', line 154
def ok? = true
|
#unwrap(_) ⇒ Object
155
|
# File 'lib/decoding/result.rb', line 155
def unwrap(_) = value
|
#unwrap! ⇒ Object
156
|
# File 'lib/decoding/result.rb', line 156
def unwrap! = value
|