class Trailblazer::Activity

This is DSL-independent code, focusing only on run-time.

Constants

NodeAttributes
Output

signal: actual signal emitted by the task color: the mapping, where this signal will travel to. This can be e.g. Left=>:success. The polarization when building the graph.

"i am traveling towards :success because ::step said so!"

semantic: the original “semantic” or role of the signal, such as :success. This usually comes from the activity hosting this output.

Public Class Methods

End(semantic) click to toggle source

Builds an {Activity::End} instance.

# File lib/trailblazer/activity/structures.rb, line 52
def self.End(semantic)
  End.new(semantic: semantic)
end
Output(signal, semantic) click to toggle source

Builds an {Activity::Output} instance.

# File lib/trailblazer/activity/structures.rb, line 47
def self.Output(signal, semantic)
  Output.new(signal, semantic).freeze
end
new(schema) click to toggle source

include Activity::Interface # TODO

# File lib/trailblazer/activity.rb, line 6
def initialize(schema)
  @schema = schema
end

Public Instance Methods

[](*key) click to toggle source

Reader and writer method for an Activity. The writer {dsl = “value”} exposes immutable behavior and will replace the old @state with a new, modified copy.

Always use the accessors to avoid leaking state to other components due to mutable write operations.

# File lib/trailblazer/activity.rb, line 23
def [](*key)
  @schema[:config][*key]
end
call(args, **circuit_options) click to toggle source
# File lib/trailblazer/activity.rb, line 10
def call(args, **circuit_options)
  @schema[:circuit].(
    args,
    **(circuit_options.merge(activity: self))
  )
end
inspect() click to toggle source
# File lib/trailblazer/activity.rb, line 31
def inspect
  %{#<Trailblazer::Activity:0x#{object_id}>}
end
to_h() click to toggle source
# File lib/trailblazer/activity.rb, line 27
def to_h
  @schema
end