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, #eql?, err, #err?, #initialize, #inspect, #map_err, ok, #to_result
Instance Method Details
#and(other) ⇒ Object
135
136
137
138
139
|
# File 'lib/decoding/result.rb', line 135
def and(other)
return other unless other.is_a?(self.class)
self.class.new(yield value, other.value)
end
|
#and_then ⇒ Object
141
|
# File 'lib/decoding/result.rb', line 141
def and_then = yield(value).to_result
|
#map ⇒ Object
133
|
# File 'lib/decoding/result.rb', line 133
def map = self.class.new(yield value)
|
#ok? ⇒ Boolean
131
|
# File 'lib/decoding/result.rb', line 131
def ok? = true
|
#unwrap(_) ⇒ Object
132
|
# File 'lib/decoding/result.rb', line 132
def unwrap(_) = value
|