Class: Interactor2
- Inherits:
-
Object
- Object
- Interactor2
- Defined in:
- lib/interactor2.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
3 4 5 |
# File 'lib/interactor2.rb', line 3 def error @error end |
Class Method Details
.perform(*args) ⇒ Object
5 6 7 |
# File 'lib/interactor2.rb', line 5 def self.perform(*args) new(*args).tap { |interactor| catch(:fail) { interactor.perform } } end |
Instance Method Details
#fail!(msg) ⇒ Object
13 14 15 16 |
# File 'lib/interactor2.rb', line 13 def fail!(msg) @error = msg throw :fail end |
#perform ⇒ Object
18 19 20 |
# File 'lib/interactor2.rb', line 18 def perform raise NotImplementedError end |
#success? ⇒ Boolean
9 10 11 |
# File 'lib/interactor2.rb', line 9 def success? @error.nil? end |