Class: Trailblazer::Activity

Inherits:
Object
  • Object
show all
Extended by:
Call
Defined in:
lib/trailblazer/activity.rb,
lib/trailblazer/activity/adds.rb,
lib/trailblazer/activity/schema.rb,
lib/trailblazer/activity/circuit.rb,
lib/trailblazer/activity/deprecate.rb,
lib/trailblazer/activity/task_wrap.rb,
lib/trailblazer/activity/introspect.rb,
lib/trailblazer/activity/structures.rb,
lib/trailblazer/activity/schema/compiler.rb,
lib/trailblazer/activity/task_wrap/runner.rb,
lib/trailblazer/activity/introspect/render.rb,
lib/trailblazer/activity/task_wrap/pipeline.rb,
lib/trailblazer/activity/schema/intermediate.rb,
lib/trailblazer/activity/task_wrap/call_task.rb,
lib/trailblazer/activity/task_wrap/extension.rb,
lib/trailblazer/activity/circuit/task_adapter.rb,
lib/trailblazer/activity/schema/implementation.rb

Overview

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

Developer’s docs: trailblazer.to/2.1/docs/internals.html#internals-activity

Defined Under Namespace

Modules: Adds, Call, Deprecate, Introspect, TaskBuilder, TaskWrap, Testing Classes: Circuit, End, Left, Output, Right, Schema, Signal, Start

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ Activity

Returns a new instance of Activity.



6
7
8
# File 'lib/trailblazer/activity.rb', line 6

def initialize(schema)
  @schema = schema
end

Class Method Details

.End(semantic) ⇒ Object

Builds an End instance.



54
55
56
# File 'lib/trailblazer/activity/structures.rb', line 54

def self.End(semantic)
  End.new(semantic: semantic)
end

.Output(signal, semantic) ⇒ Object

Builds an Output instance.



49
50
51
# File 'lib/trailblazer/activity/structures.rb', line 49

def self.Output(signal, semantic)
  Output.new(signal, semantic).freeze
end

Instance Method Details

#call(args, **circuit_options) ⇒ Object



10
11
12
13
14
15
# File 'lib/trailblazer/activity.rb', line 10

def call(args, **circuit_options)
  @schema[:circuit].(
    args,
    **circuit_options.merge(activity: self)
  )
end

#inspectObject



21
22
23
# File 'lib/trailblazer/activity.rb', line 21

def inspect
  %(#<Trailblazer::Activity:0x#{object_id}>)
end

#to_hObject



17
18
19
# File 'lib/trailblazer/activity.rb', line 17

def to_h
  @schema.to_h
end