Module: Zx::Methods
Constant Summary collapse
- Success =
->(value = nil, = {}) { Zx.Success(value, { type: :ok }.merge()) }
- Failure =
->(value = nil, = {}) { Zx.Failure(value, { type: :error }.merge()) }
Instance Method Summary collapse
- #Failure(value = nil, options = {}) ⇒ Object
- #Given(input) ⇒ Object
- #Success(value = nil, options = {}) ⇒ Object
- #Try(default = nil, options = {}) ⇒ Object
Instance Method Details
#Failure(value = nil, options = {}) ⇒ Object
26 27 28 |
# File 'lib/zx.rb', line 26 def Failure(value = nil, = {}) Zx::Result.new.failure!(value, type: .fetch(:type, :error)) end |
#Given(input) ⇒ Object
36 37 38 |
# File 'lib/zx.rb', line 36 def Given(input) Try { input } end |