Class: HecksApp::ApplicationPort::CommandRunner::Event
- Inherits:
-
Object
- Object
- HecksApp::ApplicationPort::CommandRunner::Event
- Defined in:
- lib/application_port/command_runner/event.rb
Instance Attribute Summary collapse
-
#domain_event ⇒ Object
readonly
Returns the value of attribute domain_event.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(errors: [], domain_event: nil) ⇒ Event
constructor
A new instance of Event.
- #on_fail {|_self| ... } ⇒ Object
- #on_success {|_self| ... } ⇒ Object
Constructor Details
#initialize(errors: [], domain_event: nil) ⇒ Event
Returns a new instance of Event.
6 7 8 9 |
# File 'lib/application_port/command_runner/event.rb', line 6 def initialize(errors: [], domain_event: nil) @errors = errors @domain_event = domain_event end |
Instance Attribute Details
#domain_event ⇒ Object (readonly)
Returns the value of attribute domain_event.
5 6 7 |
# File 'lib/application_port/command_runner/event.rb', line 5 def domain_event @domain_event end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/application_port/command_runner/event.rb', line 5 def errors @errors end |
Instance Method Details
#on_fail {|_self| ... } ⇒ Object
17 18 19 20 21 |
# File 'lib/application_port/command_runner/event.rb', line 17 def on_fail return if @errors.empty? yield self end |
#on_success {|_self| ... } ⇒ Object
11 12 13 14 15 |
# File 'lib/application_port/command_runner/event.rb', line 11 def on_success return unless @errors.empty? yield self end |