Class: WisperInteractor::Base
- Inherits:
-
Object
- Object
- WisperInteractor::Base
- Includes:
- Interactor, Wisper::Publisher
- Defined in:
- lib/wisper_interactor/base.rb
Class Method Summary collapse
- .instructions ⇒ Object
- .instructions=(value) ⇒ Object
- .on_failure(&blk) ⇒ Object
- .on_failure_callback ⇒ Object
- .on_failure_callback=(value) ⇒ Object
- .on_success(&blk) ⇒ Object
- .on_success_callback ⇒ Object
- .on_success_callback=(value) ⇒ Object
- .perform(&blk) ⇒ Object
- .subscribe(subscriber, **options) ⇒ Object
- .subscribers ⇒ Object
Instance Method Summary collapse
- #call ⇒ Object
-
#run! ⇒ Object
Override Interactor#run!.
Class Method Details
.instructions ⇒ Object
41 42 43 |
# File 'lib/wisper_interactor/base.rb', line 41 def self.instructions @instructions end |
.instructions=(value) ⇒ Object
37 38 39 |
# File 'lib/wisper_interactor/base.rb', line 37 def self.instructions=(value) @instructions = value end |
.on_failure(&blk) ⇒ Object
13 14 15 |
# File 'lib/wisper_interactor/base.rb', line 13 def self.on_failure(&blk) self.on_failure_callback = blk end |
.on_failure_callback ⇒ Object
33 34 35 |
# File 'lib/wisper_interactor/base.rb', line 33 def self.on_failure_callback @on_failure_callback end |
.on_failure_callback=(value) ⇒ Object
29 30 31 |
# File 'lib/wisper_interactor/base.rb', line 29 def self.on_failure_callback=(value) @on_failure_callback = value end |
.on_success(&blk) ⇒ Object
9 10 11 |
# File 'lib/wisper_interactor/base.rb', line 9 def self.on_success(&blk) self.on_success_callback = blk end |
.on_success_callback ⇒ Object
25 26 27 |
# File 'lib/wisper_interactor/base.rb', line 25 def self.on_success_callback @on_success_callback end |
.on_success_callback=(value) ⇒ Object
21 22 23 |
# File 'lib/wisper_interactor/base.rb', line 21 def self.on_success_callback=(value) @on_success_callback = value end |
.perform(&blk) ⇒ Object
17 18 19 |
# File 'lib/wisper_interactor/base.rb', line 17 def self.perform(&blk) self.instructions = blk end |
.subscribe(subscriber, **options) ⇒ Object
49 50 51 |
# File 'lib/wisper_interactor/base.rb', line 49 def self.subscribe(subscriber, **) self.subscribers << [ subscriber, ] end |
.subscribers ⇒ Object
45 46 47 |
# File 'lib/wisper_interactor/base.rb', line 45 def self.subscribers @subscribers ||= [] end |
Instance Method Details
#call ⇒ Object
60 61 62 |
# File 'lib/wisper_interactor/base.rb', line 60 def call execute :instructions end |
#run! ⇒ Object
Override Interactor#run!
55 56 57 58 |
# File 'lib/wisper_interactor/base.rb', line 55 def run! subscribe_listeners perform_instructions end |