Class: Temporalio::Workflow::Definition::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/temporalio/workflow/definition.rb

Overview

Information about the workflow definition. This is usually not used directly.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow_class:, override_name: nil, dynamic: false, init: false, raw_args: false, failure_exception_types: [], signals: {}, queries: {}, updates: {}, versioning_behavior: VersioningBehavior::UNSPECIFIED, dynamic_options_method: nil) ⇒ Info

Create a definition info. This should usually not be used directly, but instead a class that extends Temporalio::Workflow::Definition should be used.



481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
# File 'lib/temporalio/workflow/definition.rb', line 481

def initialize(
  workflow_class:,
  override_name: nil,
  dynamic: false,
  init: false,
  raw_args: false,
  failure_exception_types: [],
  signals: {},
  queries: {},
  updates: {},
  versioning_behavior: VersioningBehavior::UNSPECIFIED,
  dynamic_options_method: nil
)
  @workflow_class = workflow_class
  @override_name = override_name
  @dynamic = dynamic
  @init = init
  @raw_args = raw_args
  @failure_exception_types = failure_exception_types.dup.freeze
  @signals = signals.dup.freeze
  @queries = queries.dup.freeze
  @updates = updates.dup.freeze
  @versioning_behavior = versioning_behavior
  @dynamic_options_method = dynamic_options_method
  Internal::ProtoUtils.assert_non_reserved_name(name)
end

Instance Attribute Details

#dynamicObject (readonly)

Returns the value of attribute dynamic.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def dynamic
  @dynamic
end

#dynamic_options_methodObject (readonly)

Returns the value of attribute dynamic_options_method.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def dynamic_options_method
  @dynamic_options_method
end

#failure_exception_typesObject (readonly)

Returns the value of attribute failure_exception_types.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def failure_exception_types
  @failure_exception_types
end

#initObject (readonly)

Returns the value of attribute init.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def init
  @init
end

#override_nameObject (readonly)

Returns the value of attribute override_name.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def override_name
  @override_name
end

#queriesObject (readonly)

Returns the value of attribute queries.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def queries
  @queries
end

#raw_argsObject (readonly)

Returns the value of attribute raw_args.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def raw_args
  @raw_args
end

#signalsObject (readonly)

Returns the value of attribute signals.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def signals
  @signals
end

#updatesObject (readonly)

Returns the value of attribute updates.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def updates
  @updates
end

#versioning_behaviorObject (readonly)

Returns the value of attribute versioning_behavior.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def versioning_behavior
  @versioning_behavior
end

#workflow_classObject (readonly)

Returns the value of attribute workflow_class.



463
464
465
# File 'lib/temporalio/workflow/definition.rb', line 463

def workflow_class
  @workflow_class
end

Class Method Details

.from_class(workflow_class) ⇒ Info

Derive the workflow definition info from the class.

Parameters:

  • workflow_class (Class<Definition>)

    Workflow class.

Returns:

  • (Info)

    Built info.



471
472
473
474
475
476
477
# File 'lib/temporalio/workflow/definition.rb', line 471

def self.from_class(workflow_class)
  unless workflow_class.is_a?(Class) && workflow_class < Definition
    raise "Workflow '#{workflow_class}' must be a class and must extend Temporalio::Workflow::Definition"
  end

  workflow_class._workflow_definition
end

Instance Method Details

#nameString

Returns Workflow name.

Returns:

  • (String)

    Workflow name.



509
510
511
# File 'lib/temporalio/workflow/definition.rb', line 509

def name
  dynamic ? nil : (override_name || workflow_class.name.to_s.split('::').last)
end