Class: CallSheet::StepAdapters::Try Private

Inherits:
Base
  • Object
show all
Defined in:
lib/call_sheet/step_adapters/try.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Base

#operation, #options

Instance Method Summary collapse

Methods inherited from Base

#arity

Constructor Details

#initializeTry

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Try.

Raises:

  • (ArgumentError)


5
6
7
8
# File 'lib/call_sheet/step_adapters/try.rb', line 5

def initialize(*)
  super
  raise ArgumentError, "+try+ steps require one or more exception classes provided via +catch:+" unless options[:catch]
end

Instance Method Details

#call(*args, input) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
13
14
# File 'lib/call_sheet/step_adapters/try.rb', line 10

def call(*args, input)
  Success(operation.call(*args, input))
rescue *Array(options[:catch]) => e
  Failure(e)
end