class Safrano::Contract::Valid
represents a valid result. All tap_valid
* handlers are executed
tap_error* handlers are not executed
Attributes
result[R]
Public Class Methods
new(result)
click to toggle source
# File lib/safrano/contract.rb, line 67 def initialize(result) @result = result end
Public Instance Methods
collect_result!() { |*result| ... }
click to toggle source
# File lib/safrano/contract.rb, line 97 def collect_result! @result = yield(*@result) self # allow chaining end
error()
click to toggle source
# File lib/safrano/contract.rb, line 102 def error nil end
if_error()
click to toggle source
# File lib/safrano/contract.rb, line 84 def if_error self # allow chaining end
if_valid() { |result| ... }
click to toggle source
# File lib/safrano/contract.rb, line 80 def if_valid yield @result ## return this end
if_valid_collect() { |*result| ... }
click to toggle source
# File lib/safrano/contract.rb, line 88 def if_valid_collect yield(*@result) ## return this end
map_result!() { |result| ... }
click to toggle source
# File lib/safrano/contract.rb, line 92 def map_result! @result = yield @result self # allow chaining end
tap_error()
click to toggle source
# File lib/safrano/contract.rb, line 71 def tap_error self # allow chaining end
tap_valid() { |result| ... }
click to toggle source
# File lib/safrano/contract.rb, line 75 def tap_valid yield @result self # allow chaining end