Class: HecksApp::ApplicationPort::CommandRunner::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/application_port/command_runner/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_eventObject (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

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

Yields:

  • (_self)

Yield Parameters:



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

Yields:

  • (_self)

Yield Parameters:



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