Class: Hecks::Ports::Persistence::Outcome

Inherits:
Struct
  • Object
show all
Defined in:
lib/hecks/ports/persistence/execution.rb

Overview

Adapter outcomes are runtime facts, never command lifecycle.

Constant Summary collapse

STATUSES =
%i[inserted replaced updated conflicted missing saved].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, instance: nil) ⇒ Outcome

Returns a new instance of Outcome.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
# File 'lib/hecks/ports/persistence/execution.rb', line 8

def initialize(status:, instance: nil)
  normalized = status.to_sym
  raise ArgumentError, "unknown persistence outcome #{status.inspect}" unless STATUSES.include?(normalized)

  super(status: normalized, instance: instance)
  freeze
end

Instance Attribute Details

#instanceObject

Returns the value of attribute instance

Returns:

  • (Object)

    the current value of instance



5
6
7
# File 'lib/hecks/ports/persistence/execution.rb', line 5

def instance
  @instance
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



5
6
7
# File 'lib/hecks/ports/persistence/execution.rb', line 5

def status
  @status
end