Class: Interactor2

Inherits:
Object
  • Object
show all
Defined in:
lib/interactor2.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorObject (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

#performObject

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/interactor2.rb', line 18

def perform
  raise NotImplementedError
end

#success?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/interactor2.rb', line 9

def success?
  @error.nil?
end