Class: Hecks::Runtime::Dispatcher::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/hecks/runtime/dispatcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#eventsObject

Returns the value of attribute events

Returns:

  • (Object)

    the current value of events



19
20
21
# File 'lib/hecks/runtime/dispatcher.rb', line 19

def events
  @events
end

#execution_planObject

Returns the value of attribute execution_plan

Returns:

  • (Object)

    the current value of execution_plan



19
20
21
# File 'lib/hecks/runtime/dispatcher.rb', line 19

def execution_plan
  @execution_plan
end

#instanceObject

Returns the value of attribute instance

Returns:

  • (Object)

    the current value of instance



19
20
21
# File 'lib/hecks/runtime/dispatcher.rb', line 19

def instance
  @instance
end

#persistence_outcomeObject

Returns the value of attribute persistence_outcome

Returns:

  • (Object)

    the current value of persistence_outcome



19
20
21
# File 'lib/hecks/runtime/dispatcher.rb', line 19

def persistence_outcome
  @persistence_outcome
end

#verbObject

Returns the value of attribute verb

Returns:

  • (Object)

    the current value of verb



19
20
21
# File 'lib/hecks/runtime/dispatcher.rb', line 19

def verb
  @verb
end

Instance Method Details

#idObject

instance is nil for a port operation dispatched by verb (below) — nothing was hydrated or saved, the same reason PortOperationInterpreter#emit's own comment gives for sourcing id: off the operation's reference attribute instead. &., not a raised error: a caller that dispatches a port verb and then asks this Result for .id/.state made a category error the domain itself already told it about (there is no record here), not a crash-worthy one.



28
# File 'lib/hecks/runtime/dispatcher.rb', line 28

def id    = instance&.id

#inspectObject



36
# File 'lib/hecks/runtime/dispatcher.rb', line 36

def inspect = "#<Result #{self}>"

#stateObject



29
# File 'lib/hecks/runtime/dispatcher.rb', line 29

def state = instance&.to_h

#to_sObject



31
32
33
34
# File 'lib/hecks/runtime/dispatcher.rb', line 31

def to_s
  announced = events.empty? ? "no events" : events.map(&:name).join(", ")
  "#{verb}#{instance.inspect} | #{announced}"
end